delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/13/15:55:57

X-Recipient: archive-cygwin AT delorie DOT 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 DOT 26227 DOT qm AT web52612 DOT mail DOT re2 DOT yahoo DOT com> <4AFDC46A DOT 3070503 AT byu DOT net>
Date: Fri, 13 Nov 2009 12:55:46 -0800 (PST)
From: Salvador Fandino <sfandino AT yahoo DOT com>
Subject: Re: [BUG] fopen(..., "a") does not seek to end of file until some write operation
To: Eric Blake <ebb9 AT byu DOT net>, cygwin AT cygwin DOT com
In-Reply-To: <4AFDC46A.3070503@byu.net>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com




----- Original Message ----
> From: Eric Blake <ebb9 AT byu DOT net>
> To: cygwin AT cygwin DOT com; sfandino AT yahoo DOT 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 AT leon:/tmp$ ./a.out 
pos: 0
pos: 12
salva AT leon:/tmp$ ./a.out 
pos: 12
pos: 24
salva AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019