⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stdlib.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<PRE>#define <B>RAND_MAX</B> <I>&lt;integer constant expression &gt;= 32,767&gt;</I></PRE><P>The macro yields the maximum value returned by <CODE>rand</CODE>.</P><H2><A NAME="realloc"><CODE>realloc</CODE></A></H2><PRE>void *<B>realloc</B>(void *ptr, size_t size);</PRE><P>The function allocates an object of size <CODE>size</CODE>, possiblyobtaining initial stored values from the objectwhose address is <CODE>ptr</CODE>.It returns the address of the new object if successful; otherwise,it returns a null pointer. You can safely convert the return valueto an object pointer of any typewhose size is not greater than <CODE>size</CODE>.</P><P>If <CODE>ptr</CODE> is not a null pointer, it must be the addressof an existing object that you first allocate by calling<A HREF="#calloc"><CODE>calloc</CODE></A>,<A HREF="#malloc"><CODE>malloc</CODE></A>, or<CODE>realloc</CODE>. If the existing object is not largerthan the newly allocated object, <CODE>realloc</CODE> copies the entireexisting object to the initial part of the allocated object. (Thevalues stored in the remainder of the object are indeterminate.) Otherwise,the function copies only the initial part of the existing object thatfits in the allocated object. If <CODE>realloc</CODE> succeeds in allocatinga new object, it deallocates the existing object. Otherwise, the existingobject is left unchanged.</P><P>If <CODE>ptr</CODE> is a null pointer, the function does not storeinitial values in the newly created object.</P><H2><A NAME="size_t"><CODE>size_t</CODE></A></H2><PRE>typedef <I>ui-type</I> <B>size_t</B>;</PRE><P>The type is the unsigned integer type <CODE><I>ui-type</I></CODE>of an object that you declare to store the result of the<A HREF="express.html#sizeof operator"><I>sizeof</I></A> operator.</P><H2><A NAME="srand"><CODE>srand</CODE></A></H2><PRE>void <B>srand</B>(unsigned int seed);</PRE><P>The function stores the seed value <CODE>seed</CODE>in a static-duration object that<A HREF="#rand"><CODE>rand</CODE></A>uses to compute a pseudo-random number. From a given seed value,that function always generates the same sequence of returnvalues. The program behaves as if the target environment calls<CODE>srand(1)</CODE> at program startup.</P><H2><A NAME="strtod"><CODE>strtod</CODE></A></H2><PRE>double <B>strtod</B>(const char *s, char **endptr);</PRE><P>The function converts the initial characters of the string <CODE>s</CODE>to an equivalent value <CODE>x</CODE> of type <I>double.</I>If <CODE>endptr</CODE> is not a null pointer,the function stores a pointer to the unconvertedremainder of the string in <CODE>*endptr</CODE>. The function then returns<CODE>x</CODE>.</P><P>The initial characters of the string <CODE>s</CODE> must consist ofzero or more characters for which<A HREF="ctype.html#isspace"><CODE>isspace</CODE></A> returns nonzero,followed by an optional plus or minus sign,followed by the longest sequence of one or more characters that matchthe pattern for <CODE>strtod</CODE> shown in the diagram.</P><P><IMG SRC="strtod.gif"></P><P>Here, a <CODE><I>point</I></CODE> is the<A HREF="locale.html#decimal_point">decimal-point</A>character for the current<A HREF="locale.html#locale">locale</A>.(It is the dot (<CODE>.</CODE>) in the<A HREF="locale.html#C locale"><CODE>"C"</CODE></A> locale.)If the string <CODE>s</CODE> matches this pattern, its equivalent valueis the decimal integer represented by any digits to the left of the<CODE><I>point</I></CODE>, plus the decimal fractionrepresented by any digits to the right of the <CODE><I>point</I></CODE>,times 10 raised to the signed decimal integer powerthat follows an optional <CODE>e</CODE> or <CODE>E</CODE>. A leadingminus sign negates the value.</P><P>In locales other than the<A HREF="locale.html#C locale"><CODE>"C"</CODE></A> locale,<CODE>strtod</CODE> can define additional patterns as well.</P><P>If the string <CODE>s</CODE> does not match a valid pattern, the valuestored in <CODE>*endptr</CODE> is <CODE>s</CODE>,and <CODE>x</CODE> is zero. If a<A HREF="math.html#range error">range error</A> occurs,<CODE>strtod</CODE> behaves exactly as the functions declared in<A HREF="math.html#&lt;math.h&gt;"><CODE>&lt;math.h&gt;</CODE></A>.</P><H2><A NAME="strtol"><CODE>strtol</CODE></A></H2><PRE>long <B>strtol</B>(const char *s, char **endptr,    int base);</PRE><P>The function converts the initial characters of the string <CODE>s</CODE>to an equivalent value <CODE>x</CODE> of type <I>long.</I>If <CODE>endptr</CODE> is not a null pointer,it stores a pointer to the unconverted remainderof the string in <CODE>*endptr</CODE>.The function then returns <CODE>x</CODE>.</P><P>The initial characters of the string <CODE>s</CODE> must consist ofzero or more characters for which<A HREF="ctype.html#isspace"><CODE>isspace</CODE></A> returns nonzero,followed by the longest sequence of one or more characters that matchthe pattern for <CODE>strtol</CODE> shown in the diagram.</P><P><IMG SRC="strtol.gif"></P><P>The function accepts the sequences<CODE>0x</CODE> or <CODE>0X</CODE> onlywhen <CODE>base</CODE> equals zero or 16.The letters <CODE>a-z</CODE> or <CODE>A-Z</CODE>represent digits in the range [10, 36).If <CODE>base</CODE> is in the range[2, 36], the function accepts only digitswith values less than <CODE>base</CODE>.If <CODE>base</CODE> == 0, then a leading <CODE>0x</CODE> or <CODE>0X</CODE>(after any sign) indicates a hexadecimal (base 16) integer, a leading<CODE>0</CODE> indicates an octal (base 8) integer, and any other validpattern indicates a decimal (base 10) integer.</P><P>If the string <CODE>s</CODE> matches this pattern, its equivalentvalue is the signed integer of the appropriate base represented bythe digits that match the pattern. (A leading minus sign negates thevalue.) In locales other than the<A HREF="locale.html#C locale"><CODE>"C"</CODE></A> locale,<CODE>strtol</CODE> can define additional patterns as well.</P><P>If the string <CODE>s</CODE> does not match a valid pattern, the valuestored in <CODE>*endptr</CODE> is <CODE>s</CODE>,and <CODE>x</CODE> is zero. If theequivalent value is too large to represent as type <I>long,</I><CODE>strtol</CODE> stores the value of<A HREF="errno.html#ERANGE"><CODE>ERANGE</CODE></A> in<A HREF="errno.html#errno"><CODE>errno</CODE></A>and returns either<A HREF="limits.html#LONG_MAX"><CODE>LONG_MAX</CODE></A>,if <CODE>x</CODE> is positive, or<A HREF="limits.html#LONG_MIN"><CODE>LONG_MIN</CODE></A>,if <CODE>x</CODE> is negative.</P><H2><A NAME="strtoul"><CODE>strtoul</CODE></A></H2><PRE>unsigned long <B>strtoul</B>(const char *s, char **endptr,    int base);</PRE><P>The function converts the initial characters of the string <CODE>s</CODE>to an equivalent value <CODE>x</CODE> of type <I>unsigned long.</I>If <CODE>endptr</CODE> is not a null pointer,it stores a pointer to the unconverted remainderof the string in <CODE>*endptr</CODE>.The function then returns <CODE>x</CODE>.</P><P><CODE>strtoul</CODE> converts strings exactly as does<A HREF="#strtol"><CODE>strtol</CODE></A>,but reports a range error only if the equivalent value is too largeto represent as type <I>unsigned long.</I>In this case, <CODE>strtoul</CODE> stores the value of<A HREF="errno.html#ERANGE"><CODE>ERANGE</CODE></A> in<A HREF="errno.html#errno"><CODE>errno</CODE></A> and returns<A HREF="limits.html#ULONG_MAX"><CODE>ULONG_MAX</CODE></A>.</P><H2><A NAME="system"><CODE>system</CODE></A></H2><PRE>int <B>system</B>(const char *s);</PRE><P>If <CODE>s</CODE> is not a null pointer, the function passes the string<CODE>s</CODE> to be executed by a<B><A NAME="command processor">command processor</A></B>, supplied bythe target environment, and returns the status reported by the commandprocessor. If <CODE>s</CODE> is a null pointer, the function returns nonzeroonly if the target environment supplies a command processor. Eachimplementation defines what strings its command processor accepts.</P><H2><A NAME="wchar_t"><CODE>wchar_t</CODE></A></H2><PRE>typedef <I>i-type</I> <B>wchar_t</B>; <B>[keyword in C++]</B></PRE><P>The type is the integer type <CODE><I>i-type</I></CODE> of a<A HREF="charset.html#wide-character constant">wide-character constant</A>, such as <CODE>L'X'</CODE>.You declare an object of type <CODE>wchar_t</CODE> to hold a<A HREF="charset.html#Wide-Character Encoding">wide character</A>.</P><H2><A NAME="wcstombs"><CODE>wcstombs</CODE></A></H2><PRE>size_t <B>wcstombs</B>(char *s, const wchar_t *wcs, size_t n);</PRE><P>The function stores a multibyte string, in successive elementsof the array whose first element has the address <CODE>s</CODE>,by converting in turn each of the wide charactersin the string <CODE>wcs</CODE>. The multibyte string begins in the<A HREF="charset.html#initial conversion state">initial conversion state</A>.The function converts each wide character as if by calling<A HREF="#wctomb"><CODE>wctomb</CODE></A> (except that the<A HREF="charset.html#conversion state">conversion state</A>stored for that function is unaffected). It stores nomore than <CODE>n</CODE> bytes, stopping after it stores a null byte. Itreturns the number of bytes it stores, not counting the null byte,if all conversions are successful; otherwise, it returns -1.</P><H2><A NAME="wctomb"><CODE>wctomb</CODE></A></H2><PRE>int <B>wctomb</B>(char *s, wchar_t wchar);</PRE><P>If <CODE>s</CODE> is not a null pointer,the function determines <CODE>x,</CODE>the number of bytes needed to representthe multibyte character correspondingto the wide character <CODE>wchar</CODE>.<CODE>x</CODE> cannot exceed<A HREF="#MB_CUR_MAX"><CODE>MB_CUR_MAX</CODE></A>.The function converts <CODE>wchar</CODE> to its corresponding multibytecharacter, which it stores in successive elements of the array whosefirst element has the address <CODE>s</CODE>.It then returns <CODE>x,</CODE> or it returns -1if <CODE>wchar</CODE> does not correspond to a validmultibyte character. <CODE>wctomb</CODE> includes the terminatingnull byte in the count of bytes. The function can use a<A HREF="charset.html#conversion state">conversion state</A>stored in a static-duration object to determine how to interpret themultibyte character string.</P><P>If <CODE>s</CODE> is a null pointer and if multibyte characters have a<A HREF="charset.html#state-dependent encoding">state-dependent encoding</A>in the current<A HREF="locale.html#locale">locale</A>, the function stores the<A HREF="charset.html#initial conversion state">initial conversion state</A>in its static-duration object and returnsnonzero; otherwise, it returns zero.</P><HR><P>See also the<B><A HREF="index.html#Table of Contents">Table of Contents</A></B> and the<B><A HREF="_index.html">Index</A></B>.</P><P><I><A HREF="crit_pb.html">Copyright</A> &#169; 1989-2002by P.J. Plauger and Jim Brodie. All rights reserved.</I></P><!--V4.01:1125--></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -