stcopy() 函数将以空终止的字符串从内存中一个位置复制至另一位置。
语法
void stcopy(from, to)
char *from, *to;
from
指向您想要 stcopy() 复制的以空终止的字符串的指针。
to
指向内存中 stcopy() 复制字符串的位置的指针。
示例
此样例程序在 demo 目录中的 stcopy.ec 文件中。
/*
* stcopy.ec *
This program displays the result of copying a string using stcopy().
*/
#include
main()
{
static char string[] = "abcdefghijklmnopqrstuvwxyz";
printf("STCOPY Sample ESQL Program running.\n\n");
printf("Initial string:\n [%s]\n", string);
/* display dest */
stcopy("John Doe", &string[15]); /* copy */
GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 957 -
printf("After copy of 'John Doe' to position 15:\n [%s]\n",
string);
printf("\nSTCOPY Sample Program over.\n\n");
}
输出
STCOPY Sample ESQL Program running.
Initial string:
[abcdefghijklmnopqrstuvwxyz]
After copy of 'John Doe' to position 15:
[abcdefghijklmnoJohn Doe]
STCOPY Sample Program over.