Eric Blake wrote:
> Do we want to offer ftello(fp) as the shorter alternative to
> lseek(fileno(fp),0,SEEK_CUR) for testing seekability?

I don't think we can guarantee that, if we stick to the abstractions laid
out by POSIX. The ftello.html page says

   "The ftell() function shall obtain the current value of the file-position
    indicator for the stream pointed to by stream."

So clearly it talks about a property of the stream. I can see two situations
when ftello() would succeed although lseek() would always fail:

  - A stream with an infinite-size buffer (a buffer growing as needed),

  - An input stream that keeps track of the current position simply by
    counting the number of bytes read so far - assuming no fflush() call
    occurs.

Bruno





Reply via email to