Date: Sun, 7 Feb 1999 11:30:49 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: DJ Delorie cc: djgpp-workers AT delorie DOT com, Matecka Lubomir Subject: Re: [matecka AT hron DOT fei DOT tuke DOT sk: 'putc' problem] In-Reply-To: <199902031624.LAA25599@envy.delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com > 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 This is because the character is not casted to unsigned char in the call to _flsbuf. To be corrected in the next release. If you have library sources, then apply the following patch to the file include/libc/file.h, recompile putc.c (and fputc.c), put them into libc.a, and the problem should go away. *** include/libc/file.h~0 Sun Sep 7 21:08:12 1997 --- include/libc/file.h Sat Feb 6 11:10:46 1999 *************** *** 49,55 **** p->_cnt--; return((unsigned char)(*(p->_ptr++)=(unsigned char)x)); } ! return(_flsbuf(x,p)); } static __inline__ int __is_text_file(FILE *const p) --- 49,55 ---- p->_cnt--; return((unsigned char)(*(p->_ptr++)=(unsigned char)x)); } ! return(_flsbuf((unsigned char)x,p)); } static __inline__ int __is_text_file(FILE *const p)