mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 23:14:06 +08:00
43 lines
1.0 KiB
HTML
43 lines
1.0 KiB
HTML
<h1>字符串函数 - bcopy</h1>
|
||
|
||
|
||
<p>原型:extern void bcopy(const void *src, void *dest, int n);</p>
|
||
|
||
<p>用法:#include <string.h></p>
|
||
|
||
<p>功能:将字符串src的前n个字节复制到dest中</p>
|
||
|
||
<p>说明:bcopy不检查字符串中的空字节NULL,函数没有返回值。</p>
|
||
|
||
举例:<pre><code class="language-c">
|
||
|
||
// bcopy.c
|
||
|
||
#include <syslib.h>
|
||
#include <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>
|
||
|