delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/27/07:54:59

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Mon, 27 Oct 2003 13:54:43 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cyg 1.5.5-1: fgetpos returns -1 problem
Message-ID: <20031027125443.GU1653@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <000101c39c7a$ff220a70$05010a0a AT axel>
Mime-Version: 1.0
In-Reply-To: <000101c39c7a$ff220a70$05010a0a@axel>
User-Agent: Mutt/1.4.1i

On Mon, Oct 27, 2003 at 12:10:56PM +0100, Axel Naumann wrote:
> Hi,
> 
> I have a problem with glibc's fgetpos on current cygwin. Looking around
> I couldn't find a previous posting on it. 
> 
> Running this test program:
> ---
> #include <stdio.h>
> 
> int main(int argc,char**argv) {
>    FILE *file = fopen("fo.C","rb"); // use any existing file here
>    FILE *write= tmpfile();
>    char c = fgetc(file);

Thanks for the report.  As it turns out, it's a problem related to
using the tmpfile() function.  The exported function is in contrast
to other file IO functions not 64 bit aware.  A fix requires to
release a new Cygwin DLL and, unfortunately, to relink your application
against the new DLL to work correctly.
As a temporary measure, create the temporary file using some other
function for now.

>       fgetpos(write,&wpos);
>       fprintf(stderr,"%d vs %d\n",pos,wpos);

As a side note, the type fpos_t is 64 bit long.  You should use
%lld to print it correctly.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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