Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux Printf到达空字符时不会停止打印_Linux_String_Null_Printf - Fatal编程技术网

Linux Printf到达空字符时不会停止打印

Linux Printf到达空字符时不会停止打印,linux,string,null,printf,Linux,String,Null,Printf,我试图调试程序中的空解引用。程序从用户提交的web表单接收数据。这个问题似乎与空字段有关。当用户提交表单时,表数据最终在char*tabledata变量中检索 tabledata使用以下格式处理表的数据: "row1column1value/row1column2value/row1column3value|row2column1value/row2column2value/row2column3value|\0" 出于调试目的,im打印表格数据内容时使用: printf\n tabledat

我试图调试程序中的空解引用。程序从用户提交的web表单接收数据。这个问题似乎与空字段有关。当用户提交表单时,表数据最终在char*tabledata变量中检索

tabledata使用以下格式处理表的数据:

"row1column1value/row1column2value/row1column3value|row2column1value/row2column2value/row2column3value|\0"
出于调试目的,im打印表格数据内容时使用:

printf\n tabledata是=%s\n\n,tabledata

但是当我提交表格时,如果我将第二行的第一列留空,我将得到以下输出:

 tabledata is = 11/22/33/44/55/22/33|(null)/1/44/55/88/33/44|
printf到达空字符时,怎么可能不停止打印?如何检查此空值是否真的是\0空字符?

%s和printf将无法执行此操作

您必须使用putstabledata

希望这能回答你的问题