uTools-Manuals/docs/c/bcopy.html

43 lines
985 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>字符串函数 - bcopy</h1>
<p>原型extern void bcopy(const void *src, void *dest, int n);</p>
<p>用法:#include &lt;string.h></p>
<p>功能将字符串src的前n个字节复制到dest中</p>
<p>说明bcopy不检查字符串中的空字节NULL函数没有返回值。</p>
举例:<pre><code class="language-c">
// bcopy.c
#include &lt;syslib.h>
#include &lt;string.h>
main()
{
char *s="Golden Global View";
char d[20];
clrscr(); // clear screen
bcopy(s,d,6);
printf("s: %s\n",s);
printf("d: %s\n",d);
getchar();
clrscr();
s[13]=0;
bcopy(s+7,d,11); // bcopy ignore null in string
printf("%s\n",s+7);
for(i=0;i<11;i++)
putchar(d[i]);
getchar();
return 0;
}
</code></pre>相关函数:<a href="bcmp.html">bcmp</a>,<a href="bzero.html">bzero</a>