Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 fscanf 从一个数字列表的文件中读取(长度是任意的)
42 20 8 5 0
但是,我不确定如何构造一个读取任意数量的值的格式字符串。
尝试这个
while(fscanf(fp,"%d",&number) == 1) { printf("%d",number); }
fscanf返回读取的项目数并在文件末尾返回 EOF
fscanf