uTools-Manuals/docs/c/strncat.html
2019-04-21 11:50:48 +08:00

37 lines
906 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1>字符串函数 - strncat</h1>
<p>原型extern char *strncat(char *dest,char *src,int n);</p>
<p>用法:#include &lt;string.h></p>
<p>功能把src所指字符串的前n个字符添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0'。</p>
<p>说明src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。</p>
返回指向dest的指针。
举例:<pre><code class="language-c">
// strncat.c
#include &lt;syslib.h>
#include &lt;string.h>
main()
{
char d[20]="Golden Global";
char *s=" View WinIDE Library";
clrscr();
strncat(d,s,5);
printf("%s",d);
getchar();
return 0;
}
</code></pre>相关函数:<a href="strcat.html">strcat</a>