X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 	tests=BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <158595.94935.qm@web52607.mail.re2.yahoo.com>
References: <592384.26227.qm@web52612.mail.re2.yahoo.com> <4AFDC46A.3070503@byu.net>
Date: Fri, 13 Nov 2009 12:55:46 -0800 (PST)
From: Salvador Fandino <sfandino@yahoo.com>
Subject: Re: [BUG] fopen(..., "a") does not seek to end of file until some write operation
To: Eric Blake <ebb9@byu.net>, cygwin@cygwin.com
In-Reply-To: <4AFDC46A.3070503@byu.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@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





----- Original Message ----
> From: Eric Blake <ebb9@byu.net>
> To: cygwin@cygwin.com; sfandino@yahoo.com
> Sent: Fri, November 13, 2009 9:41:14 PM
> Subject: Re: [BUG] fopen(..., "a") does not seek to end of file until some write operation
> 
> -----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.

In Linux (at least on the one I have installed, Ubuntu 9.10) ftell does not return cero but the EOF offset:

salva@leon:/tmp$ ./a.out 
pos: 0
pos: 12
salva@leon:/tmp$ ./a.out 
pos: 12
pos: 24
salva@leon:/tmp$ ./a.out 
pos: 24
pos: 36

Cheers,

- Salva

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

