bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw lseek bug


From: Bruno Haible
Subject: Re: mingw lseek bug
Date: Mon, 28 May 2007 17:25:57 +0200
User-agent: KMail/1.5.4

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

[Prev in Thread] Current Thread [Next in Thread]