寻找使用scanf函数读,但我想停止阅读,如果我遇到一个“”‘\ 0’(行)或EOF拆分scanf函数输入数组,直到EOF
我真的不知道如何停止实现这一点。
我用
char * aBuff;
char * bBuff;
char * cBuff;
//read in the first three lines and put them into char arrays
//while (scan() != (',' || '\0' || EOF)) //was trying to put it into a while loop, wasn't sure
scanf("%s", aBuff);
scanf("%s", bBuff);
scanf(%s, cBUff);
我打算取输入,并把它们放在不同的阵列。基本上需要输入,直到一个或新的行,并将数据放入数组中,并继续此过程直到文件结束。
'的scanf()'将只能看到格式到''\ 0''。 '“%[^,\ 0]”将显示为“”%[^,“'。 – chux 2014-12-04 03:58:17