{"id":76823,"date":"2026-02-23T11:09:54","date_gmt":"2026-02-23T03:09:54","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/76823.html"},"modified":"2026-02-23T11:09:54","modified_gmt":"2026-02-23T03:09:54","slug":"c%e8%af%ad%e8%a8%80%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97%ef%bc%9a%e4%bb%8e%e9%9b%b6%e5%88%b0%e7%b2%be%e9%80%9a","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/76823.html","title":{"rendered":"C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a"},"content":{"rendered":"<h3>\u5341\u3001\u5b57\u7b26\u51fd\u6570\u548c\u5b57\u7b26\u4e32\u51fd\u6570<\/h3>\n<h4>1.\u5b57\u7b26\u5206\u7c7b\u51fd\u6570<\/h4>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 C\u8bed\u8a00\u63d0\u4f9b\u4e86\u4e13\u95e8\u7528\u6765\u5b57\u7b26\u5206\u7c7b\u7684\u51fd\u6570\u3002\u4f7f\u7528\u65f6\u9700\u8981\u5305\u542b\u5934\u6587\u4ef6&lt;ctype.h&gt;\u3002<\/p>\n<table align=\"center\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:500px\">\n<tr>\u51fd\u6570\u4e3a\u771f\u8fd4\u56de\u975e\u96f6\u503c&#xff0c;\u4e3a\u5047\u8fd4\u56de0<\/tr>\n<tbody>\n<tr>\n<td>iscntrl<\/td>\n<td>\u4efb\u4f55\u63a7\u5236\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>isspace<\/td>\n<td>\u7a7a\u767d\u5b57\u7b26&#xff1a;\u7a7a\u683c&#039; &#039;\u3001\u6362\u9875&#039;\\\\f&#039;\u3001\u6362\u884c&#039;\\\\n&#039;\u3001\u56de\u8f66&#039;\\\\r&#039;\u3001\u5236\u8868\u7b26&#039;\\\\t&#039;\u6216\u8005\u5782\u76f4\u5236\u8868\u7b26&#039;\\\\v&#039;<\/td>\n<\/tr>\n<tr>\n<td>isdigit<\/td>\n<td>\u5341\u8fdb\u5236\u6570\u5b57<\/td>\n<\/tr>\n<tr>\n<td>isxdigit<\/td>\n<td>\u5341\u516d\u8fdb\u5236\u6570\u5b57<\/td>\n<\/tr>\n<tr>\n<td>islower<\/td>\n<td>\u5c0f\u5199\u5b57\u6bcda~z<\/td>\n<\/tr>\n<tr>\n<td>isupper<\/td>\n<td>\u5927\u5199\u5b57\u6bcdA~Z<\/td>\n<\/tr>\n<tr>\n<td>isalpha<\/td>\n<td>\u5b57\u6bcda~z\u6216A~Z<\/td>\n<\/tr>\n<tr>\n<td>isalnum<\/td>\n<td>\u5b57\u6bcd\u6216\u6570\u5b57<\/td>\n<\/tr>\n<tr>\n<td>ispunct<\/td>\n<td>\u6807\u70b9\u7b26\u53f7&#xff0c;\u4efb\u4f55\u4e0d\u5c5e\u4e8e\u6570\u5b57\u6216\u5b57\u6bcd\u7684\u56fe\u5f62\u5b57\u7b26&#xff08;\u53ef\u6253\u5370&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>isgraph<\/td>\n<td>\u4efb\u4f55\u56fe\u5f62\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>isprint<\/td>\n<td>\u4efb\u4f55\u53ef\u6253\u5370\u5b57\u7b26&#xff0c;\u5305\u62ec\u56fe\u5f62\u5b57\u7b26\u548c\u7a7a\u767d\u5b57\u7b26<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>2.\u5b57\u7b26\u8f6c\u6362\u51fd\u6570<\/h4>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 C\u8bed\u8a00\u8fd8\u63d0\u4f9b\u4e862\u4e2a\u5b57\u7b26\u8f6c\u6362\u51fd\u6570&#xff1a;<\/p>\n<p>int tolower (int c);\/\/\u5c06\u5927\u5199\u5b57\u6bcd\u8f6c\u6210\u5c0f\u5199\u5b57\u6bcd<\/p>\n<p>int toupper (int c);\/\/\u5c06\u5c0f\u5199\u5b57\u6bcd\u8f6c\u6210\u5927\u5199\u5b57\u6bcd<\/p>\n<h4>3.strlen\u7684\u4f7f\u7528\u548c\u6a21\u62df\u5b9e\u73b0<\/h4>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 &#xff08;\u4e00&#xff09;strlen\u51fd\u6570&#xff1a;\u8ba1\u7b97\u5b57\u7b26\u4e32\u957f\u5ea6<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 size_t strlen (const char* str);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *\u5b57\u7b26\u4e32&#xff0c;\u4ee5&#039;\\\\0&#039;\u4f5c\u4e3a\u7ed3\u675f\u6807\u5fd7&#xff0c;\u00a0strlen\u51fd\u6570\u8fd4\u56de\u7684\u662f\u5728\u5b57\u7b26\u4e32\u4e2d&#039;\\\\0&#039;\u524d\u9762\u51fa\u73b0\u7684\u5b57\u7b26\u4e2a\u6570&#xff0c;\u4e0d\u5305\u542b&#039;\\\\0&#039;\u3002<br \/>\n\u00a0 \u00a0 \u00a0 \u00a0 *\u53c2\u6570\u6307\u5411\u7684\u5b57\u7b26\u4e32\u5fc5\u987b\u8981\u4ee5&#039;\\\\0&#039;\u7ed3\u675f&#xff0c;\u8fd4\u56de\u503c\u4e3asize_t\u662f\u65e0\u7b26\u53f7\u7684,strlen\u7684\u4f7f\u7528\u9700\u8981\u5305\u542b\u5934\u6587\u4ef6&lt;string.h&gt;\u3002<\/p>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 &#xff08;\u4e8c&#xff09;strlen\u51fd\u6570\u6a21\u62df\u5b9e\u73b0<\/h5>\n<p>\/\/\u8ba1\u6570\u5668<br \/>\nint my_strlen(const char* p)<br \/>\n{<br \/>\n    assert(p);<br \/>\n    int count&#061;0;<br \/>\n    while(*p)<br \/>\n    {<br \/>\n        count&#043;&#043;;<br \/>\n        p&#043;&#043;;<br \/>\n    }<br \/>\n    return count;<br \/>\n}<br \/>\n\/\/\u9012\u5f52<br \/>\nint my_strlen(const char* p)<br \/>\n{<br \/>\n    assert(p);<br \/>\n    if(*p&#061;&#061;&#039;\\\\0&#039;)<br \/>\n        return 0;<br \/>\n    else<br \/>\n        return 1&#043;my_strlen(p&#043;1);<br \/>\n}<br \/>\n\/\/\u6307\u9488-\u6307\u9488<br \/>\nint my_strlen(const char* p)<br \/>\n{<br \/>\n    assert(p);<br \/>\n    char *p1&#061;p;<br \/>\n    while(*p)<br \/>\n        p&#043;&#043;;<br \/>\n    return p-p1;<br \/>\n}<\/p>\n<h4>4.strcpy\u7684\u4f7f\u7528\u548c\u6a21\u62df\u5b9e\u73b0<\/h4>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 &#xff08;\u4e00&#xff09;strcpy\u51fd\u6570&#xff1a;\u5c06\u4e00\u4e2a\u5b57\u7b26\u4e32\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e2d\u3002<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 char *strcpy(char *dest,const char *src);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *\u6e90\u5b57\u7b26\u4e32\u5fc5\u987b\u4ee5&#039;\\\\0&#039;\u7ed3\u675f&#xff0c;\u62f7\u8d1d\u65f6\u6e90\u5b57\u7b26\u4e32\u4e2d\u7684&#039;\\\\0&#039;\u4e5f\u8981\u62f7\u8d1d\u8fc7\u53bb\u3002<br \/>\n\u00a0 \u00a0 \u00a0 \u00a0 *\u76ee\u6807\u7a7a\u95f4\u5fc5\u987b\u53ef\u4ee5\u4fee\u6539\u5e76\u4e14\u8db3\u591f\u5927&#xff0c;\u786e\u4fdd\u5b57\u7b26\u4e32\u987a\u5229\u62f7\u8d1d\u3002<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*\u4f7f\u7528\u65f6\u9700\u8981\u5305\u542b\u5934\u6587\u4ef6&lt;string.h&gt;\u3002<\/p>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 &#xff08;\u4e8c&#xff09;strcpy\u51fd\u6570\u6a21\u62df\u5b9e\u73b0<\/h5>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;assert.h&gt;<br \/>\nchar *my_strcpy(char *dest,const char*src)<br \/>\n{<br \/>\n    assert(dest&amp;&amp;src);<br \/>\n    char *ret&#061;dest;<br \/>\n    while(*dest&#043;&#043;&#061;&#061;*src&#043;&#043;)<br \/>\n        ;<br \/>\n    return ret;<br \/>\n}<br \/>\nint main()<br \/>\n{<br \/>\n    char str1[]&#061;&#034;abcdef&#034;;<br \/>\n    char str2[20];<br \/>\n    char *str&#061;my_strcpy(str1,str2);<br \/>\n    printf(&#034;%s\\\\n&#034;,str1);<br \/>\n    printf(&#034;%s\\\\n&#034;,str);<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>5.strcat\u7684\u4f7f\u7528\u548c\u6a21\u62df\u5b9e\u73b0<\/h4>\n<h5>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#xff08;\u4e00&#xff09;strcat\u51fd\u6570&#xff1a;\u5c06\u4e00\u4e2a\u5b57\u7b26\u4e32\u8fde\u63a5\u5230\u53e6\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684\u672b\u5c3e\u3002<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 char *strcat(char *dest,const char *src);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *\u6e90\u5b57\u7b26\u4e32\u5fc5\u987b\u4ee5&#039;\\\\0&#039;\u7ed3\u675f&#xff0c;\u76ee\u6807\u5b57\u7b26\u4e32\u4e5f\u5fc5\u987b\u5305\u542b&#039;\\\\0&#039;&#xff0c;\u5426\u5219\u8ffd\u52a0\u65f6\u5019\u4e0d\u77e5\u9053\u4ece\u54ea\u91cc\u8d77\u59cb\u548c\u7ed3\u675f\u3002<br \/>\n\u00a0 \u00a0 \u00a0 \u00a0 *\u76ee\u6807\u7a7a\u95f4\u5fc5\u987b\u53ef\u4ee5\u4fee\u6539\u5e76\u4e14\u8db3\u591f\u5927&#xff0c;\u786e\u4fdd\u5b57\u7b26\u4e32\u987a\u5229\u8ffd\u52a0\u3002<\/p>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 &#xff08;\u4e8c&#xff09;strcat\u51fd\u6570\u6a21\u62df\u5b9e\u73b0<\/h5>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;assert.h&gt;<br \/>\nchar *my_strcat(char *dest,const char *src)<br \/>\n{<br \/>\n    assert(dest&amp;&amp;src);<br \/>\n    char *ret&#061;dest;<br \/>\n    while(*dest)<br \/>\n        dest&#043;&#043;;<br \/>\n    while(*dest&#043;&#043;&#061;*src&#043;&#043;)<br \/>\n        ;<br \/>\n    return ret;<br \/>\n}<br \/>\nint main()<br \/>\n{<br \/>\n    char str1[20]&#061;&#034;abcdef&#034;;<br \/>\n    char str2[]&#061;&#034;ghijklmn&#034;;<br \/>\n    char *str&#061;my_strcat(str1,str2);<br \/>\n    printf(&#034;%s\\\\n&#034;,str1);<br \/>\n    printf(&#034;%s\\\\n&#034;,str);<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>*\u8be5\u4ee3\u7801\u65e0\u6cd5\u5b9e\u73b0\u5b57\u7b26\u4e32\u8ffd\u52a0\u672c\u8eab\u3002<\/p>\n<h4>6.strcmp\u7684\u4f7f\u7528\u548c\u6a21\u62df\u5b9e\u73b0<\/h4>\n<h5>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#xff08;\u4e00&#xff09;strcmp\u51fd\u6570&#xff1a;\u5b57\u7b26\u4e32\u6bd4\u8f83\u51fd\u6570<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 int strcmp(const char *str1,const char *str2);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *\u5b57\u7b26\u4e32\u8981\u4ee5&#039;\\\\0&#039;\u7ed3\u675f&#xff0c;\u4e24\u4e2a\u5b57\u7b26\u4e32\u8fdb\u884c\u6309\u4f4d\u6bd4\u8f83\u5bf9\u5e94\u7684ASCII\u503c&#xff0c;str1\u5927\u4e8estr2&#xff0c;\u8fd4\u56de\u5927\u4e8e0\u7684\u6570\u5b57&#xff1b;str1\u7b49\u4e8estr2&#xff0c;\u8fd4\u56de0&#xff1b;str1\u5c0f\u4e8estr2&#xff0c;\u8fd4\u56de\u5c0f\u4e8e0\u7684\u6570\u5b57\u3002<br \/>\n\u00a0 \u00a0 \u00a0 \u00a0 *\u4f7f\u7528\u65f6\u9700\u8981\u5305\u542b\u5934\u6587\u4ef6&lt;string.h&gt;\u3002<\/p>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 &#xff08;\u4e8c&#xff09;strcmp\u51fd\u6570\u6a21\u62df\u5b9e\u73b0<\/h5>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;assert.h&gt;<br \/>\nint my_strcmp(const char *str1,const char *str2)<br \/>\n{<br \/>\n    assert(str1&amp;&amp;str2);<br \/>\n    while(*str1&#061;&#061;*str2)<br \/>\n    {<br \/>\n        if(*str1&#061;&#061;&#039;\\\\0&#039;)<br \/>\n            return 0;<br \/>\n        str1&#043;&#043;;<br \/>\n        str2&#043;&#043;;<br \/>\n    }<br \/>\n    return *str1-*str2;<br \/>\n}<br \/>\nint main()<br \/>\n{<br \/>\n    char str1[]&#061;&#034;abcdef&#034;;<br \/>\n    char str2[]&#061;&#034;abbcc&#034;;<br \/>\n    int ret&#061;my_strcmp(str1,str2);<br \/>\n    printf(&#034;%d\\\\n&#034;,ret);<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>7.strncpy\u7684\u4f7f\u7528<\/h4>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 strncpy\u51fd\u6570&#xff1a;\u4ece\u6e90\u5b57\u7b26\u4e32\u4e2d\u62f7\u8d1d\u6307\u5b9a\u6570\u91cf\u7684\u5b57\u7b26\u5230\u76ee\u6807\u5b57\u7b26\u4e32\u3002<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 char *strncpy(char *dest,const char *src,size_t n);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *n\u662f\u6307\u5b9a\u62f7\u8d1d\u5b57\u7b26\u6570&#xff0c;\u5982\u679c\u6e90\u5b57\u7b26\u4e32\u957f\u5ea6\u5c0f\u4e8en&#xff0c;\u76ee\u6807\u5b57\u7b26\u4e32\u5c06\u7528\u2018\\\\0\u2019\u586b\u5145\u81f3n\u4e2a\u5b57\u7b26\u3002\u5982\u679c\u6e90\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u5927\u4e8en&#xff0c;\u76ee\u6807\u5b57\u7b26\u4e32\u53ef\u80fd\u4e0d\u4f1a\u4ee5&#039;\\\\0&#039;\u7ed3\u5c3e\u3002<\/p>\n<h4>8.strncat\u7684\u4f7f\u7528<\/h4>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 strncat\u51fd\u6570&#xff1a;\u5c06\u6e90\u5b57\u7b26\u4e32\u7684\u524dn\u4e2a\u5b57\u7b26\u8ffd\u52a0\u5230\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u672b\u5c3e\u3002<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 char *strncat(char *dest,const char *src,size_t n);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *\u51fd\u6570\u4f1a\u81ea\u52a8\u5728\u8ffd\u52a0\u7684\u5b57\u7b26\u540e\u6dfb\u52a0\u7ec8\u6b62\u7b26&#039;\\\\0&#039;\u3002<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*\u5982\u679c\u6e90\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u5c0f\u4e8en&#xff0c;\u53ea\u4f1a\u5c06\u6e90\u5b57\u7b26\u4e32\u4e2d\u5230&#039;\\\\0&#039;\u7684\u5185\u5bb9\u8ffd\u52a0\u5230\u76ee\u6807\u5b57\u7b26\u4e32\u672b\u5c3e\u3002<\/p>\n<h4>9.strncmp\u7684\u4f7f\u7528<\/h4>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 strncmp\u51fd\u6570&#xff1a;\u6bd4\u8f83\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u524dn\u4e2a\u5b57\u7b26\u3002<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 int strncmp(const char *str1,const char *str2,size_t n);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *\u6bd4\u8f83\u5728\u9047\u5230\u7a7a\u5b57\u7b26\u6216\u6bd4\u8f83\u5b8cn\u4e2a\u5b57\u7b26\u4e3a\u6b62\u3002<br \/>\n\u00a0 \u00a0 \u00a0 \u00a0 *str1\u5c0f\u4e8estr2&#xff0c;\u8fd4\u56de\u5c0f\u4e8e0\u7684\u503c&#xff1b;str1\u7b49\u4e8estr2&#xff0c;\u8fd4\u56de0&#xff1b;str1\u5927\u4e8estr2&#xff0c;\u8fd4\u56de\u5927\u4e8e0\u7684\u503c\u3002<\/p>\n<h4>10.strstr\u7684\u4f7f\u7528\u548c\u6a21\u62df\u5b9e\u73b0<\/h4>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0&#xff08;\u4e00&#xff09; strstr\u51fd\u6570&#xff1a;\u67e5\u627e\u5b50\u5b57\u7b26\u4e32\u5728\u5b57\u7b26\u4e32\u4e2d\u7684\u9996\u6b21\u51fa\u73b0\u4f4d\u7f6e\u3002<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 char *strstr(const char *str1,const char *str2);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *\u5982\u679c\u627e\u5230\u5b50\u5b57\u7b26\u4e32&#xff0c;\u8fd4\u56de\u6307\u5411\u9996\u6b21\u51fa\u73b0\u4f4d\u7f6e\u7684\u6307\u9488\u3002\u5982\u679c\u672a\u627e\u5230&#xff0c;\u8fd4\u56deNULL\u3002<\/p>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 &#xff08;\u4e8c&#xff09;strstr\u51fd\u6570\u6a21\u62df\u5b9e\u73b0<\/h5>\n<p>#include &lt;stdio.h&gt;<br \/>\nchar* my_strstr(const char* str1,const char* str2)<br \/>\n{<br \/>\n    char* s1&#061;NULL;<br \/>\n    char* s2&#061;NULL;<br \/>\n    char* cur&#061;str1;<br \/>\n    while(*cur)<br \/>\n    {<br \/>\n        s1&#061;cur;<br \/>\n        s2&#061;str2;<br \/>\n        while(*s1&#061;&#061;*s2&amp;&amp;*s1!&#061;&#039;\\\\0&#039;&amp;&amp;*s2!&#061;&#039;\\\\0&#039;)<br \/>\n        {<br \/>\n            s1&#043;&#043;;<br \/>\n            s2&#043;&#043;;<br \/>\n        }<br \/>\n        if(*s2&#061;&#061;&#039;\\\\0&#039;)<br \/>\n            return cur;<br \/>\n        cur&#043;&#043;;<br \/>\n    }<br \/>\n    return NULL;<br \/>\n}<br \/>\nint main()<br \/>\n{<br \/>\n    char arr1[]&#061;&#034;abbbcdef&#034;;<br \/>\n    char arr2[]&#061;&#034;bbcde&#034;;<br \/>\n    char* ret&#061;my_strstr(arr1,arr2);<br \/>\n    if(ret!&#061;NULL)<br \/>\n        printf(&#034;%s\\\\n&#034;,ret);<br \/>\n    else<br \/>\n        printf(&#034;\u6ca1\u627e\u5230\\\\n&#034;);<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>11.strtok\u7684\u4f7f\u7528<\/h4>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 strtok\u51fd\u6570&#xff1a;\u5b57\u7b26\u4e32\u5206\u5272\u51fd\u6570&#xff0c;\u7528\u4e8e\u5c06\u5b57\u7b26\u4e32\u6309\u6307\u5b9a\u7684\u5206\u5272\u7b26\u62c6\u5206\u4e3a\u591a\u4e2a\u5b50\u5b57\u7b26\u4e32\u3002<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 char *strtok(char *str,const char *sep);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 *str\u5f85\u5206\u5272\u7684\u5b57\u7b26\u4e32\u5728\u9996\u6b21\u8c03\u7528\u65f6\u4f20\u5165&#xff0c;\u540e\u7eed\u8c03\u7528\u4f20\u5165NULL\u3002strtok\u51fd\u6570\u4f1a\u8fd4\u56de\u4e0b\u4e00\u4e2a\u5b50\u5b57\u7b26\u4e32\u7684\u6307\u9488&#xff0c;\u5982\u679c\u6ca1\u6709\u66f4\u591a\u7684\u5b57\u7b26\u4e32&#xff0c;\u8fd4\u56deNULL\u3002<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*strtok\u51fd\u6570\u627e\u5230str\u4e2d\u7684\u4e0b\u4e00\u4e2a\u6807\u8bb0&#xff0c;\u5e76\u7528&#039;\\\\0&#039;\u7ed3\u5c3e\u3002strtok\u51fd\u6570\u4f1a\u6539\u53d8\u5f85\u5207\u5206\u7684\u5b57\u7b26\u4e32&#xff0c;\u6240\u4ee5\u88abstrtok\u51fd\u6570\u5207\u5206\u7684\u5b57\u7b26\u4e32\u4e00\u822c\u90fd\u662f\u4e34\u65f6\u62f7\u8d1d\u7684\u5185\u5bb9&#xff0c;\u5e76\u4e14\u53ef\u4ee5\u4fee\u6539\u3002<\/p>\n<h4>12.strerror\u7684\u4f7f\u7528<\/h4>\n<h5>\u00a0 \u00a0 \u00a0 \u00a0 strerror\u51fd\u6570&#xff1a;\u5c06\u9519\u8bef\u7801\u8f6c\u6362\u4e3a\u53ef\u8bfb\u7684\u9519\u8bef\u4fe1\u606f\u5b57\u7b26\u4e32\u3002<\/h5>\n<p>\u8bed\u6cd5\u5f62\u5f0f&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 char *strerror(int errnum);<\/p>\n<p>errnum:\u9519\u8bef\u7801\u3002&#xff08;\u901a\u5e38\u4e3aerrno\u7684\u503c&#xff09;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u5728\u4e0d\u540c\u7684\u7cfb\u7edf\u548cC\u8bed\u8a00\u6807\u51c6\u5e93\u7684\u5b9e\u73b0\u4e2d&#xff0c;\u90fd\u89c4\u5b9a\u4e86\u4e00\u4e9b\u9519\u8bef\u7801&#xff0c;\u4e00\u822c\u662f\u653e\u5728\u8fd9\u4e2a&lt;errno.h&gt;\u5934\u6587\u4ef6\u4e2d\u8bf4\u660e\u7684\u3002C\u8bed\u8a00\u7a0b\u5e8f\u542f\u52a8\u7684\u65f6\u5019\u5c31\u4f1a\u4f7f\u7528\u4e00\u4e2a\u5168\u5c40\u53d8\u91cferrno\u6765\u8bb0\u5f55\u7a0b\u5e8f\u5f53\u524d\u7684\u9519\u8bef\u7801&#xff0c;\u53ea\u4e0d\u8fc7\u7a0b\u5e8f\u542f\u52a8\u65f6\u9519\u8bef\u7801\u4e3a0&#xff0c;\u8868\u793a\u6ca1\u6709\u9519\u8bef\u3002\u5728\u4f7f\u7528\u6807\u51c6\u5e93\u4e2d\u7684\u51fd\u6570\u53d1\u751f\u4e86\u67d0\u79cd\u9519\u8bef&#xff0c;\u5c31\u4f1a\u5c06\u5bf9\u5e94\u7684\u9519\u8bef\u7801\u653e\u5728\u8fd9\u4e2a\u53d8\u91cf\u4e2d\u3002\u800c\u4e00\u4e2a\u9519\u8bef\u7801\u7684\u6570\u5b57\u662f\u6574\u6570&#xff0c;\u5f88\u96be\u7406\u89e3\u662f\u4ec0\u4e48\u610f\u601d&#xff0c;\u6240\u4ee5\u6bcf\u4e00\u4e2a\u9519\u8bef\u7801\u90fd\u662f\u6709\u5bf9\u5e94\u7684\u9519\u8bef\u4fe1\u606f\u7684\u3002\u8fd9\u4e2a\u51fd\u6570\u5c31\u53ef\u4ee5\u5c06\u5bf9\u5e94\u7684\u9519\u8bef\u4fe1\u606f\u5b57\u7b26\u4e32\u7684\u5730\u5740\u8fd4\u56de\u3002<\/p>\n<p>*perror\u51fd\u6570\u901a\u5e38\u548c\u9519\u8bef\u7801\u7ed3\u5408\u4f7f\u7528&#xff0c;perror\u53ef\u4ee5\u6839\u636eerrno\u7684\u503c&#xff0c;\u8f93\u51fa\u5bf9\u5e94\u7684\u9519\u8bef\u63cf\u8ff0\u4fe1\u606f\u3002\u5f53perror\u7684\u53c2\u6570\u662f\u4e00\u4e2a\u81ea\u5b9a\u4e49\u5b57\u7b26\u4e32\u65f6&#xff0c;\u4f1a\u4f5c\u4e3a\u9519\u8bef\u4fe1\u606f\u7684\u524d\u7f00\u8f93\u51fa&#xff08;\u518d\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\u548c\u4e00\u4e2a\u7a7a\u683c&#xff09;&#xff1b;\u5982\u679c\u53c2\u6570\u662f\u7a7a\u6307\u9488&#xff0c;\u5219\u8fdb\u8f93\u51fa\u9519\u8bef\u63cf\u8ff0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5341\u3001\u5b57\u7b26\u51fd\u6570\u548c\u5b57\u7b26\u4e32\u51fd\u65701.\u5b57\u7b26\u5206\u7c7b\u51fd\u6570C\u8bed\u8a00\u63d0\u4f9b\u4e86\u4e13\u95e8\u7528\u6765\u5b57\u7b26\u5206\u7c7b\u7684\u51fd\u6570\u3002\u4f7f\u7528\u65f6\u9700\u8981\u5305\u542b\u5934\u6587\u4ef6\u3002\u51fd\u6570\u4e3a\u771f\u8fd4\u56de\u975e\u96f6\u503c&#xff0c;\u4e3a\u5047\u8fd4\u56de0iscntrl\u4efb\u4f55\u63a7\u5236\u5b57\u7b26isspace\u7a7a\u767d\u5b57\u7b26&#xff1a;\u7a7a\u683c \u3001\u6362\u9875\\\\f\u3001\u6362\u884c\\\\n\u3001\u56de\u8f66\\\\r\u3001\u5236\u8868\u7b26\\\\t\u6216\u8005\u5782\u76f4\u5236\u8868\u7b26\\\\visdigit\u5341\u8fdb\u5236\u6570\u5b57isxdigit\u5341\u516d\u8fdb\u5236\u6570\u5b57islower\u5c0f\u5199\u5b57\u6bcda~zisupper\u5927\u5199\u5b57\u6bcdA~Zisalpha\u5b57\u6bcda~z\u6216A~Zisalnum\u5b57\u6bcd\u6216\u6570\u5b57ispunct\u6807\u70b9\u7b26\u53f7&amp;#<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[174,190],"topic":[],"class_list":["post-76823","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/76823.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5341\u3001\u5b57\u7b26\u51fd\u6570\u548c\u5b57\u7b26\u4e32\u51fd\u65701.\u5b57\u7b26\u5206\u7c7b\u51fd\u6570C\u8bed\u8a00\u63d0\u4f9b\u4e86\u4e13\u95e8\u7528\u6765\u5b57\u7b26\u5206\u7c7b\u7684\u51fd\u6570\u3002\u4f7f\u7528\u65f6\u9700\u8981\u5305\u542b\u5934\u6587\u4ef6\u3002\u51fd\u6570\u4e3a\u771f\u8fd4\u56de\u975e\u96f6\u503c&#xff0c;\u4e3a\u5047\u8fd4\u56de0iscntrl\u4efb\u4f55\u63a7\u5236\u5b57\u7b26isspace\u7a7a\u767d\u5b57\u7b26&#xff1a;\u7a7a\u683c \u3001\u6362\u9875\\f\u3001\u6362\u884c\\n\u3001\u56de\u8f66\\r\u3001\u5236\u8868\u7b26\\t\u6216\u8005\u5782\u76f4\u5236\u8868\u7b26\\visdigit\u5341\u8fdb\u5236\u6570\u5b57isxdigit\u5341\u516d\u8fdb\u5236\u6570\u5b57islower\u5c0f\u5199\u5b57\u6bcda~zisupper\u5927\u5199\u5b57\u6bcdA~Zisalpha\u5b57\u6bcda~z\u6216A~Zisalnum\u5b57\u6bcd\u6216\u6570\u5b57ispunct\u6807\u70b9\u7b26\u53f7&amp;#\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/76823.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-23T03:09:54+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76823.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/76823.html\",\"name\":\"C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-23T03:09:54+00:00\",\"dateModified\":\"2026-02-23T03:09:54+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/76823.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/76823.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76823.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/76823.html","og_locale":"zh_CN","og_type":"article","og_title":"C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5341\u3001\u5b57\u7b26\u51fd\u6570\u548c\u5b57\u7b26\u4e32\u51fd\u65701.\u5b57\u7b26\u5206\u7c7b\u51fd\u6570C\u8bed\u8a00\u63d0\u4f9b\u4e86\u4e13\u95e8\u7528\u6765\u5b57\u7b26\u5206\u7c7b\u7684\u51fd\u6570\u3002\u4f7f\u7528\u65f6\u9700\u8981\u5305\u542b\u5934\u6587\u4ef6\u3002\u51fd\u6570\u4e3a\u771f\u8fd4\u56de\u975e\u96f6\u503c&#xff0c;\u4e3a\u5047\u8fd4\u56de0iscntrl\u4efb\u4f55\u63a7\u5236\u5b57\u7b26isspace\u7a7a\u767d\u5b57\u7b26&#xff1a;\u7a7a\u683c \u3001\u6362\u9875\\f\u3001\u6362\u884c\\n\u3001\u56de\u8f66\\r\u3001\u5236\u8868\u7b26\\t\u6216\u8005\u5782\u76f4\u5236\u8868\u7b26\\visdigit\u5341\u8fdb\u5236\u6570\u5b57isxdigit\u5341\u516d\u8fdb\u5236\u6570\u5b57islower\u5c0f\u5199\u5b57\u6bcda~zisupper\u5927\u5199\u5b57\u6bcdA~Zisalpha\u5b57\u6bcda~z\u6216A~Zisalnum\u5b57\u6bcd\u6216\u6570\u5b57ispunct\u6807\u70b9\u7b26\u53f7&amp;#","og_url":"https:\/\/www.wsisp.com\/helps\/76823.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-23T03:09:54+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/76823.html","url":"https:\/\/www.wsisp.com\/helps\/76823.html","name":"C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-23T03:09:54+00:00","dateModified":"2026-02-23T03:09:54+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/76823.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/76823.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/76823.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C\u8bed\u8a00\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u5230\u7cbe\u901a"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=76823"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76823\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=76823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=76823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=76823"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=76823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}