Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: David Warren MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16397.44803.957497.819723@gargle.gargle.HOWL> Date: Tue, 20 Jan 2004 17:43:15 -0500 (EST) To: cygwin AT cygwin DOT com Subject: unsigned char in getc()? I'm getting an int value of -80 returned by getc(), whereas fgetc() returns 176 for the same input character. This seems to be caused by the definition of getc() in cygwin/usr/include/mingw/stdio.h, which is: __CRT_INLINE int __cdecl getc (FILE* __F) { return (--__F->_cnt >= 0) ? (int) *__F->_ptr++ : _filbuf (__F); } The _ptr field is of type char* (not unsigned char*). A definition of getc() I found elsewhere is: #define getc(_stream) (--(_stream)->_cnt >= 0 \ ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) which and's in the 0xff to get the unsigned value. This seems to have become broken in a recent gcc. Shouldn't this be fixed, or am I misunderstanding something? -David S. Warren XSB, Inc. -- 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/