Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!talcott!wjh12!pixel!pixdoc!vsh From: vsh@pixdoc.UUCP (Steve Harris) Newsgroups: net.bugs Subject: Bug in putc Message-ID: <41@pixdoc.UUCP> Date: Wed, 26-Mar-86 18:57:13 EST Article-I.D.: pixdoc.41 Posted: Wed Mar 26 18:57:13 1986 Date-Received: Sun, 20-Apr-86 10:18:13 EST Organization: Pixel Systems, Woburn, MA Lines: 13 There is a bug in the putc macro, in stdio.h. Putc returns an int which contains the char you have just "put". However, (at least on both a Pixel and a Sun), the result is sign extended; if the 8th bit of the char is set, the return value from putc does not equal the character you put! To fix, replace the putc macro with the following: #define putc(x,p) ((int) ((--(p)->_cnt>=0? ((unsigned char)(*(p)->_ptr++=(x))):(unsigned char)_flsbuf((x),p)))) -- Steve Harris | {allegra|ihnp4|cbosgd|ima|genrad|amd|harvard}\ xePIX, Inc. | !wjh12!pixel!pixdoc!vsh 51 Lake Street | Nashua, NH 03060 | +1 603 881 8791