From: Edmund B. <ne...@ya...> - 2001-03-29 22:18:35
|
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 |