This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cyg 1.5.5-1: fgetpos returns -1 problem


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@cygwin.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]