I've noticed when i use fscanf to advance through a file whenever i have a fscanf line it goes to the next line in the file. What i want to do is:
if theres 4 fields in the textfield :
Code:while (fscanf(file, "%d %s %s %f", &temp->var1, temp->var2, temp->var3, &temp->var4) == 4) { if (fscanf(file, "%d %s %s %f", &temp->var1, temp->var2, temp->var3, &temp->var4) != 4) { exit(0); // exit here since it didn't meet our crieteria. } // all went OK do something with the file. } any idea on why it skips some lines and how to exactly check if fscanf has returned 4 or not without going to a next line?



LinkBack URL
About LinkBacks



afte the while i just checked if its end of the file or not and exited.