mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-05-06 11:46:09 +08:00
35 lines
787 B
HTML
35 lines
787 B
HTML
<h1>字符串函数 - memset</h1>
|
|
|
|
|
|
<p>原型:extern void *memset(void *buffer, int c, int count);</p>
|
|
|
|
<p>用法:#include <string.h></p>
|
|
|
|
<p>功能:把buffer所指内存区域的前count个字节设置成字符c。</p>
|
|
|
|
<p>说明:返回指向buffer的指针。</p>
|
|
|
|
举例:<pre><code class="language-c">
|
|
|
|
|
|
// memset.c
|
|
|
|
#include <syslib.h>
|
|
#include <string.h>
|
|
|
|
main()
|
|
{
|
|
char *s="Golden Global View";
|
|
|
|
clrscr();
|
|
|
|
memset(s,'G',6);
|
|
printf("%s",s);
|
|
|
|
getchar();
|
|
return 0;
|
|
}
|
|
|
|
</code></pre>相关函数:<a href="bzero.html">bzero</a>,<a href="setmem.html">setmem</a>,<a href="strset.html">strset</a>
|
|
|