C standards question

Zack Weinberg zack@rabi.columbia.edu
Sat Sep 26 22:11:00 GMT 1998


Is this guaranteed to be safe?

f = fopen(file, "r");
...
fgetpos(f, &pos);
fclose(f);
...
f = fopen(file, "r");
fsetpos(f, &pos);
...

In other words, does an fpos_t cookie remain valid if the stream is
closed and reopened (on the same file), even on systems where a file
isn't an unstructured stream of bytes?

zw



More information about the Libc-hacker mailing list