fgetpos/ftello without system call

Florian Weimer fweimer@redhat.com
Fri Sep 1 09:17:00 GMT 2017


Is it possible to obtain the current read offset of a stream without
triggering an lseek system call?

I know that nothing manipulates the underlying file descriptor directly.

The actual goal here is to read the same line multiple times using
fgets, enlarging the buffer if necessary.

It seems that libio maintains an _offset member in the underlying FILE
object, but never actually uses it for descriptor-based files (mapped
files are a different story).

Thanks,
Florian



More information about the Libc-help mailing list