【发布时间】:2015-07-19 11:43:42
【问题描述】:
我尝试从文件中读取一些数据并将其插入队列,插入功能运行良好,我尝试使用 printfs 捕获错误。我在 while() 行中看到有错误。像这样的文件形式的数据
12345 2
11232 4
22311 4
22231 2
void read_file(struct Queue *head){
FILE *fp;
int natid;
int cond;
fp=fopen("patients.txt","r");
while (fscanf(fp,"%d %d", natid, cond) != EOF)
insert(head,natid,cond);
fclose(fp);}
【问题讨论】: