delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/27/06:11:43

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
X-Authenticated: #9087063
Reply-To: <axel AT fnal DOT gov>
From: "Axel Naumann" <axel-naumann AT gmx DOT de>
To: <cygwin AT cygwin DOT com>
Cc: "'Philippe Canal'" <pcanal AT fnal DOT gov>
Subject: cyg 1.5.5-1: fgetpos returns -1 problem
Date: Mon, 27 Oct 2003 12:10:56 +0100
Message-ID: <000101c39c7a$ff220a70$05010a0a@axel>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

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

   fpos_t pos;
   fpos_t wpos;
   while (c!=EOF) {
      c = fgetc(file);
      fputc(c,write);
      fgetpos(file,&pos);
      fgetpos(write,&wpos);
      fprintf(stderr,"%d vs %d\n",pos,wpos);
   }
   fseek(write,0,SEEK_SET);
   c = fgetc(write);
   while (c!=EOF) {
      fprintf(stderr,"%c",c);
      c = fgetc(write);
      fgetpos(write,&wpos);
      fprintf(stderr,"%d\n",wpos);
   }
   return 0;
}
---
gives
---
[...]
r569
e570
t571
u572
r573
n574
 575
0576
;577

578
}579

580

581

582
---
on linux - which is what I'd expect to see. On cygwin 1.5.5-1, gcc
3.3.1-2 not in mingw mode (other relevant packages updated today) the
same code gives
---
[...]
r-1
e-1
t-1
u-1
r-1
n-1
 -1
0-1
;-1

-1
}-1

-1
---

Is this different behaviour on linux and cygwin expected? I reverted to
gcc 3.2 to do a regression check, but the problem persists. If someone
points me to how to revert my glibc to an older version I'm happy to add
the results of the regression test.

Any help solving this suprising behaviour is appreciated; if someone
needs more input to reproduce it please let me know.

Best regards, Axel.


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