stchar() 函数在定长的字符串中存储以空终止的字符串,如果有必要,则以空格填充
末尾。
语法
void stchar(from, to, count)
char *from;
char *to;
mint count;
from
指向以空终止的源字符串的第一个字节的指针。
GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 953 -
to
指向定长目标字符串的指针。此参数可指向重叠 from 参数指向的位置的位置。在此
情况下,GBase 8s ESQL/C 丢弃 from 指向的值。
count
定长目标字符串中的字节数。
示例
此样例程序在 demo 目录中的 stchar.ec 文件中。
/*
* stchar.ec *
The following program shows the blank padded result produced by stchar() function.
*/
#include
main()
{
static char src[] = "start";
static char dst[25] = "123abcdefghijkl;.";
printf("STCHAR Sample ESQL Program running.\n\n");
printf("Source string: [%s]\n", src);
printf("Destination string before stchar: [%s]\n", dst);
stchar(src, dst, sizeof(dst) - 1);
printf("Destination string after stchar: [%s]\n", dst);
printf("\nSTCHAR Sample Program over.\n\n");
}
GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 954 -
输出
STCHAR Sample ESQL Program running.
Source string: [start]
Destination string before stchar: [123abcdefghijkl;.]
Destination string after stchar: [start ]
STCHAR Sample Program over.