This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [BUG] fopen(..., "a") does not seek to end of file until some write operation

Eric Blake wrote:

> According to Salvador Fandino on 11/13/2009 1:36 PM:

>> Using ftell() after fopen(..., "a") returns 0 even when the file open for appending is not empty. AFAIK, it should return the size of the file.
> Not a bug.  POSIX allows this behavior, and Linux does it as well.  POSIX
> also allows BSD behavior of seeking to the end, although this is less
> friendly to reading back a file opened with fopen(...,"a+").  So portable
> programs can't expect either situation, and you MUST use fseek when
> opening for append if you expect a particular position.

  I'm really confused; aren't you saying that there is exactly no difference
between opening for append and just opening in ordinary r/w mode?  I always
thought the positioning of the write pointer immediately after open was the
only possible difference there could be.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]