From: Georg F. <fu...@is...> - 2001-03-30 09:47:16
|
int fputc( int c, FILE *stream ); That the ISO declaration for "fputc", so it correct to use to bytes Edmund Bertschinger wrote: > > Hi, > > I am a new user of gcc-2.95.2 on a PC running Windows > 98. Right away I discovered what seems to be a bug in > the standard library routine fputc (and also fwrite): > If one tries to write a single byte with integer value > 10, fputc writes *two* bytes: 13,10. A simple test > code (appended) illustrates this. > > I didn't find any mention of this at the egroups > archive, which is why I am posting to this list. Is > anyone familiar with this bug? Is there a workaround? > > Thanks, > Bev > > /* Test program to illustrate bug in Mingw gcc-2.95.2 > stdio/libc routine fputc. > The program is supposed to write a single byte to > test.dat, namely the > integer value entered at runtime. It works > correctly except for the > integer value 10. In that case, it writes out 2 > bytes: 13,10. */ > > #include <stdio.h> > > void main () > { > int a; > FILE *fp; > > printf("Enter integer (0-255) to write to file > test.dat: "); > scanf("%d",&a); > > fp = fopen("test.dat","w"); > putc(a,fp); > fclose(fp); > } > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/?.refer=text > > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options at: > http://lists.sourceforge.net/lists/listinfo/mingw-users -- Georg Fusz Technische Universitaet Berlin, Germany Fon: Uni.: +49 30 314 26 884 privat: +49 30 815 30 32 Handy: +49 173 20 10 696 Homepage: http://www.cadlab.tu-berlin.de/~fusz/ |