[BUG] fopen(..., "a") does not seek to end of file until some write operation
Eric Blake
ebb9@byu.net
Fri Nov 13 20:51:00 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Salvador Fandino on 11/13/2009 1:36 PM:
> Hii
>> 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.
- --
Don't work too hard, make some time for fun as well!
Eric Blake ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkr9xGoACgkQ84KuGfSFAYC8CACgtx1ZxOtKVaGF2xk2UHg+1B7c
7cUAniO/T6EOm0gxRRx/1wsCM6P2HXXl
=xedo
-----END PGP SIGNATURE-----
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list