Date: Wed, 3 Feb 1999 11:24:05 -0500 Message-Id: <199902031624.LAA25599@envy.delorie.com> From: DJ Delorie To: djgpp-workers AT delorie DOT com Subject: [matecka AT hron DOT fei DOT tuke DOT sk: 'putc' problem] Reply-To: djgpp-workers AT delorie DOT com ------- Start of forwarded message ------- Return-Path: From: Matecka Lubomir Subject: 'putc' problem To: dj AT delorie DOT com Date: Wed, 3 Feb 1999 12:40:31 +0100 (MET) Content-Type: text hello, there is some problem with 'putc' in djgpp v2.01. it should only return EOF when error occured, but it also returns EOF (= -1) when first character sent to created file is 0xff consider following code: #include void main (void) { FILE *f; char c=0xff; int i; f=fopen ("test.bug", "wb"); if (!f) return; for (i=0; i<3; i++) printf ("%d\n", putc (c, f)); fclose (f); } it should print: 255 255 255 on screen (at least this is what this code compiled with other compilers do) but compiled with djgpp it prints: -1 255 255, so comparison with EOF atfer first call of 'putc' makes 'true'. note, that this problem doesn't appear when 'c' is defined as 'unsigned char' lubo matecka (misty) matecka AT hron DOT fei DOT tuke DOT sk ------- End of forwarded message -------