我基本上使用C函数fscanf()从文件中读取数据。使用fopen并检查它我知道文件正在通过检查返回值成功打开。fscanf从文件中读取
该文件格式化为Char,Int,Int。我的问题是我一次只能读一行,并退出循环。希望如果有人可以看到我错了
char c;
char nl;
int t1, t2;
int dataTest;
do
{
dataTest = fscanf(fp, "%c %d %d", &c, &t1, &t2);
fscanf(fp, "%c", &nl);
printf("%c %d %d \n", c, t1, t2);
if (dataTest = -1)
{
break;
}
}while(1);
争取最小的例子。在这种情况下,大部分代码(&description!)不是重现问题所必需的。 –