delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
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 <warren AT cs DOT sunysb DOT edu> |
MIME-Version: | 1.0 |
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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |