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]

cyg 1.5.5-1: fgetpos returns -1 problem


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/


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