我尝试将空字符输入到定界符列表中,但它不接受。我尝试输入“ \ 0”,但它不接受。我什至尝试用转义字符加双引号,但它仍然不接受。
有办法吗?
如果允许以双\0
精度结尾的字符串结尾,则可以构建自己的函数,例如:
#include <stdio.h>
#include <string.h>
int main(void)
{
char *s = "abc\0def\0ghi\0";
char *p = s;
while (*p) {
puts(p);
p = strchr(p, '\0');
p++;
}
return 0;
}
输出:
abc
def
ghi
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句