03-14-2002
6,
0
Join Date: Mar 2002
Last Activity: 4 April 2002, 1:50 PM EST
Posts: 6
Thanks Given: 0
Thanked 0 Times in 0 Posts
fscanf()
thanks to everyone for your earlier replies, but i have yet another problem with file i/o. i'm trying to read multiple lines with the same file, and have been using the following code to take in the first two lines from a file...
fscanf(fileptr, "%d %d %d %d %d %d\n", &n1, &n2, &n3, &n4, &n5, &n6);
...some code in between...
fscanf(fileptr, "%d %d %d %d %d %d\n", &n1, &n2, &n3, &n4, &n5, &n6);
...what ends up happening is that it reads the first line in the file twice without continuing down to the second line. is there some sort of flag or identifier i need to set in order to ensure that the fileptr doesn't reset to the beginning? might i be accidentally resetting the fileptr (though i only use it in fopen, fclose, fscanf) inadvertently? any help would be greatly appreciated, thanks again...