
please wait
fseek()
's, since there's a lot of stuff between the beginning of the file and what I want. However, the information being searched for is manually inputted by the user, so typo's are possible.rewind()
, but would like to, instead, have a pointer stay at the beginning of the potentially-relevant section of the file while another pointer runs through the file itself. That way, should there have been a typo, the moving pointer can simply return to the value of the initial pointer.
|
|
fseek()
's are only applied to f, the contents of mem also move. I have also tried using const FILE* mem=f
, but the mem pointer still moves. I have also tried FILE* mem = *f
and FILE* mem = &f
, which didn't work for obvious reasons.FILE* m = f;
doesn't make a new copy of the FILE instance. Have you thought about the implications if it did? For example, what do you think should happen with the extra file handle?
1 2 3 4 5
fseek(f,4,SEEK_CUR)
, f would move to before 3. In practice, as I am currently doing, so does mem. However, is it not possible for mem to remain before 1, so that f can then jump back to that position? Basically, is it not possible to partially rewind a file pointer?fclose(f)
in the code followed by manipulations of mem.