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

📄 stdlib.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<PRE>void *<B>calloc</B>(size_t nelem, size_t size);</PRE><P>The function allocates an array object containing <CODE>nelem</CODE>elements each of size <CODE>size</CODE>, stores zeros in all bytes of thearray, and returns the address of the first element of the array ifsuccessful; otherwise, it returns a null pointer. You can safely convertthe return value to an object pointer of any type whose size in bytesis not greater than <CODE>size</CODE>.</P><H2><A NAME="div"><CODE>div</CODE></A></H2><PRE>div_t <B>div</B>(int numer, int denom);ldiv_t <B>div</B>(long numer, long denom); <B>[C++ only]</B></PRE><P>The function divides <CODE>numer</CODE> by <CODE>denom</CODE> and returnsboth quotient and remainder in the structureresult <CODE>x</CODE>, if the quotient can be represented.The structure member <CODE>x.quot</CODE>is the algebraic quotient truncated toward zero.The structure member <CODE>x.rem</CODE> is the remainder, suchthat <CODE>numer == x.quot*denom + x.rem</CODE>.</P><H2><A NAME="div_t"><CODE>div_t</CODE></A></H2><PRE>typedef struct {    int quot, rem;    } <B>div_t</B>;</PRE><P>The type is the structure type returned by the function<A HREF="#div"><CODE>div</CODE></A>.The structure contains members that represent the quotient(<CODE>quot</CODE>) and remainder (<CODE>rem</CODE>)of a signed integer division with operands of type <I>int.</I> Themembers shown above can occur in either order.</P><H2><A NAME="exit"><CODE>exit</CODE></A></H2><PRE>void <B>exit</B>(int status);</PRE><P>The function calls all functions registered by<A HREF="#atexit"><CODE>atexit</CODE></A>,closes all files, and returns control to the target environment. If<CODE>status</CODE> is zero or<A HREF="#EXIT_SUCCESS"><CODE>EXIT_SUCCESS</CODE></A>,the program reports successful termination. If <CODE>status</CODE> is<A HREF="#EXIT_FAILURE"><CODE>EXIT_FAILURE</CODE></A>, theprogram reports unsuccessful termination. An implementation can defineadditional values for <CODE>status</CODE>.</P><H2><A NAME="EXIT_FAILURE"><CODE>EXIT_FAILURE</CODE></A></H2><PRE>#define <B>EXIT_FAILURE</B> <I>&lt;rvalue integer expression&gt;</I></PRE><P>The macro yields the value of the <CODE>status</CODE> argument to<A HREF="#exit"><CODE>exit</CODE></A>that reports unsuccessful termination.</P><H2><A NAME="EXIT_SUCCESS"><CODE>EXIT_SUCCESS</CODE></A></H2><PRE>#define <B>EXIT_SUCCESS</B> <I>&lt;rvalue integer expression&gt;</I></PRE><P>The macro yields the value of the <CODE>status</CODE> argument to<A HREF="#exit"><CODE>exit</CODE></A>that reports successful termination.</P><H2><A NAME="free"><CODE>free</CODE></A></H2><PRE>void <B>free</B>(void *ptr);</PRE><P>If <CODE>ptr</CODE> is not a null pointer, the function deallocatesthe object whose address is <CODE>ptr</CODE>; otherwise, it does nothing.You can deallocate only objects that you first allocate by calling<A HREF="#calloc"><CODE>calloc</CODE></A>,<A HREF="#malloc"><CODE>malloc</CODE></A>, or<A HREF="#realloc"><CODE>realloc</CODE></A>.</P><H2><A NAME="getenv"><CODE>getenv</CODE></A></H2><PRE>char *<B>getenv</B>(const char *name);</PRE><P>The function searches an<B><A NAME="environment list">environment list</A></B>,which each implementation defines, for an entrywhose name matches the string <CODE>name</CODE>. Ifthe function finds a match, it returns a pointer to a static-durationobject that holds the definition associated with the target environmentname. Otherwise, it returns a null pointer. Do not alter the valuestored in the object. If you call <CODE>getenv</CODE> again, the value storedin the object can change. No target environment names are requiredof all environments.</P><H2><A NAME="labs"><CODE>labs</CODE></A></H2><PRE>long <B>labs</B>(long i);</PRE><P>The function returns the absolute value of <CODE>i</CODE>,<CODE>|i|</CODE>, the same as<A HREF="#abs"><CODE>abs</CODE></A>.</P><H2><A NAME="ldiv"><CODE>ldiv</CODE></A></H2><PRE>ldiv_t <B>ldiv</B>(long numer, long denom);</PRE><P>The function divides <CODE>numer</CODE> by <CODE>denom</CODE> and returnsboth quotient and remainder in the structureresult <CODE>x</CODE>, if the quotient can be represented.The structure member <CODE>x.quot</CODE>is the algebraic quotient truncated toward zero.The structure member <CODE>x.rem</CODE> is the remainder, suchthat <CODE>numer == x.quot*denom + x.rem</CODE>.</P><H2><A NAME="ldiv_t"><CODE>ldiv_t</CODE></A></H2><PRE>typedef struct {    long quot, rem;    } <B>ldiv_t</B>;</PRE><P>The type is the structure type returned by the function<A HREF="#ldiv"><CODE>ldiv</CODE></A>.The structure contains members that represent the quotient(<CODE>quot</CODE>) and remainder (<CODE>rem</CODE>)of a signed integer division with operands of type <I>long.</I> Themembers shown above can occur in either order.</P><H2><A NAME="malloc"><CODE>malloc</CODE></A></H2><PRE>void *<B>malloc</B>(size_t size);</PRE><P>The function allocates an object of size <CODE>size</CODE>, and returnsthe address of the object if successful; otherwise, it returns a nullpointer. The values stored in the object are indeterminate. You cansafely convert the return value to an object pointer of any type whosesize is not greater than <CODE>size</CODE>.</P><H2><A NAME="MB_CUR_MAX"><CODE>MB_CUR_MAX</CODE></A></H2><PRE>#define <B>MB_CUR_MAX</B> <I>&lt;rvalue integer expression &gt;= 1&gt;</I></PRE><P>The macro yields the maximum number of characters that constitute a<A HREF="charset.html#Multibyte Characters">multibyte character</A>in the current<A HREF="locale.html">locale</A>. Its value is &lt;=<A HREF="limits.html#MB_LEN_MAX"><CODE>MB_LEN_MAX</CODE></A>.</P><H2><A NAME="mblen"><CODE>mblen</CODE></A></H2><PRE>int <B>mblen</B>(const char *s, size_t n);</PRE><P>If <CODE>s</CODE> is not a null pointer, the function returns thenumber of bytes in the multibyte string <CODE>s</CODE> that constitute thenext multibyte character, or it returns -1 if the next <CODE>n</CODE>(or the remaining) bytes do not constitute a valid multibyte character.<CODE>mblen</CODE> does not include the terminating null in the count ofbytes. The function can use a<A HREF="charset.html#conversion state">conversion state</A>stored in an internalstatic-duration object to determine howto interpret the multibyte 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 internal static-duration object andreturns nonzero; otherwise, it returns zero.</P><H2><A NAME="mbstowcs"><CODE>mbstowcs</CODE></A></H2><PRE>size_t <B>mbstowcs</B>(wchar_t *wcs, const char *s, size_t n);</PRE><P>The function stores a wide character string, in successive elementsof the array whose first element has the address <CODE>wcs</CODE>,by converting, in turn, each of the multibyte charactersin the multibyte string <CODE>s</CODE>.The string begins in the<A HREF="charset.html#initial conversion state">initial conversion state</A>.The function converts each character as if by calling<A HREF="#mbtowc"><CODE>mbtowc</CODE></A> (except thatthe internal conversion state stored for that function is unaffected).It stores at most <CODE>n</CODE> wide characters, stopping after it storesa null wide character. It returns the number of wide characters itstores, not counting the null wide character, if all conversions aresuccessful; otherwise, it returns -1.</P><H2><A NAME="mbtowc"><CODE>mbtowc</CODE></A></H2><PRE>int <B>mbtowc</B>(wchar_t *pwc, const char *s, size_t n);</PRE><P>If <CODE>s</CODE> is not a null pointer,the function determines <CODE>x</CODE>,the number of bytes in the multibyte string <CODE>s</CODE> that constitutethe next multibyte character.(<CODE>x</CODE> cannot be greater than<A HREF="#MB_CUR_MAX"><CODE>MB_CUR_MAX</CODE></A>.)If <CODE>pwc</CODE> is not a null pointer, the function converts the nextmultibyte character to its corresponding wide-character value andstores that value in <CODE>*pwc</CODE>.It then returns <CODE>x,</CODE> or itreturns -1 if the next <CODE>n</CODE> or the remaining bytes do notconstitute a valid multibyte character. <CODE>mbtowc</CODE> does not includethe terminating null in the count of bytes. The function can use a<A HREF="charset.html#conversion state">conversion state</A>stored in an internal static-duration object to determinehow to interpret the multibyte 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 internal static-duration object andreturns nonzero; otherwise, it returns zero.</P><H2><A NAME="NULL"><CODE>NULL</CODE></A></H2><PRE>#define <B>NULL</B> <I>&lt;either 0, 0L, or (void *)0&gt;</I> <B>[0 in C++]</B></PRE><P>The macro yields a null pointer constant that is usable as an<A HREF="express.html#address constant expression">address constant expression</A>.</P><H2><A NAME="qsort"><CODE>qsort</CODE></A></H2><PRE>extern "C++"    void <B>qsort</B>(void *base, size_t nelem, size_t size,        int (*cmp)(const void *e1, const void *e2));            <B>[C++ only]</B>extern "C" <B>[C++ only]</B>    void <B>qsort</B>(void *base, size_t nelem, size_t size,        int (*cmp)(const void *e1, const void *e2));</PRE><P>The function sorts, in place, an array consisting of <CODE>nelem</CODE>elements, each of <CODE>size</CODE> bytes, beginning with the element whoseaddress is <CODE>base</CODE>. It calls the comparison function whose addressis <CODE>cmp</CODE> to compare pairs of elements. The comparison functionmust return a negative value if <CODE>e1</CODE> is less than <CODE>e2</CODE>,zero if the two are equal, or a positive value if <CODE>e1</CODE> is greaterthan <CODE>e2</CODE>. Two array elements that are equal can appear in thesorted array in either order.</P><H2><A NAME="rand"><CODE>rand</CODE></A></H2><PRE>int <B>rand</B>(void);</PRE><P>The function computes a pseudo-random number <CODE>x</CODE> basedon a seed value stored in an internal static-duration object, altersthe stored seed value, and returns <CODE>x.</CODE><CODE>x</CODE> is in the interval [0,<A HREF="#RAND_MAX"><CODE>RAND_MAX</CODE></A>].</P><H2><A NAME="RAND_MAX"><CODE>RAND_MAX</CODE></A></H2>

⌨️ 快捷键说明

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