请采取以下措施:
char buffer[512];
memset(buffer, 0, sizeof(buffer));
sprintf(&buffer[0],"This Is The Longest String In the World that in text goes on and..");
printf("Buffer:%s\r\n",buffer);
我希望能够在多行上创建此字符串,以便于故障排除和编辑。但是,当我使用该\
命令时,我的输出由似乎是标签的内容分隔?
例子:
sprintf(&buffer[0],"This Is The\
Longest String In the World\
that in text goes on and..");
产生以下输出:
Buffer:This Is The Longest String In the World that in text goes on and..
有任何想法吗?这只是尝试在多行代码中分解字符串的错误方法吗?