X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 	tests=AWL,BAYES_00,SPF_SOFTFAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4AFDC46A.3070503@byu.net>
Date: Fri, 13 Nov 2009 13:41:14 -0700
From: Eric Blake <ebb9@byu.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: cygwin@cygwin.com, sfandino@yahoo.com
Subject: Re: [BUG] fopen(..., "a") does not seek to end of file until some  write operation
References: <592384.26227.qm@web52612.mail.re2.yahoo.com>
In-Reply-To: <592384.26227.qm@web52612.mail.re2.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

-----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

