while(!feof(fp)){
fscanf(fp,"%d %s %s %d %d %d\n",&(staff[i].num),staff[i].name,staff[i].sex,&(staff[i].basepay),&(staff[i].extrapay),&(staff[i].day));
*j++;
i++;
}//上图的代码
很简单的代码,就是把txt中每一行的数据依次存入结构体数组中,用for循环有效,但是改成while循环就没用了怎么回事?
PHP中文网2017-04-17 14:38:19
A low-level error, *j++ needs to be bracketed, it should be (*j)++. Although it has no impact on the problem, it made me mistakenly think that the data was not passed into the structure array. In addition, I ran the search function before and it reported that it did not exist, so I thought the data was not saved.
In addition, the compiler is a bit convulsive. Just turn it off after watching a movie and run it again.