byfill() 函数以一个字符填充指定的区域。
GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 616 -
语法
void byfill(to, length, ch)
char *to;
mint length;
char ch;
to
指向您想要 byfill() 填充的内存区域的第一个字节的指针。
length
您想要 byfill() 在该区域内重复该字符的次数。
ch
您想要 byfill() 用于填充该区域的字符。
重要: 请注意,不要重写您想要 byfill() 填充的区域相邻的内存区域。
示例
此样例程序位于 demo 目录中的 byfill.ec 文件中。
/*
* byfill.ec *
The following program shows the results of three byfill() operations on an area that is
initialized to x's.
*/
#include
main()
{
static char area[20] = "xxxxxxxxxxxxxxxxxxx";
printf("BYFILL Sample ESQL Program running.\n\n");
printf("String = %s\n", area);
GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 617 -
printf("\nFilling string with five 's' characters:\n");
byfill(area, 5, 's');
printf("Result = %s\n", area);
printf("\nFilling string with two 's' characters starting at ");
printf("position 16:\n");
byfill(&area[16], 2, 's');
printf("Result = %s\n", area);
printf("Filling entire string with 'b' characters:\n");
byfill(area, sizeof(area)-1, 'b');
printf("Result = %s\n", area);
printf("\nBYFILL Sample Program over.\n\n");
}
输出
BYFILL Sample ESQL Program running.
String = xxxxxxxxxxxxxxxxxxx
Filling string with five 's' characters:
Result = sssssxxxxxxxxxxxxxx
Filling string with two 's' characters starting at position 16:
Result = sssssxxxxxxxxxxxssx
Filling entire string with 'b' characters:
Result = bbbbbbbbbbbbbbbbbbb
BYFILL Sample Program over.