Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site myrias.UUCP Path: utzoo!decvax!tektronix!uw-beaver!ubc-vision!alberta!myrias!dab From: dab@myrias.UUCP (Danny Boulet) Newsgroups: net.lang.c,net.micro.att Subject: Re: Why doesn't this work? (3B2 problem) Message-ID: <231@myrias.UUCP> Date: Sat, 29-Mar-86 19:55:29 EST Article-I.D.: myrias.231 Posted: Sat Mar 29 19:55:29 1986 Date-Received: Mon, 31-Mar-86 02:53:07 EST References: <276@birtch.UUCP> Distribution: na Organization: Myrias Research, Edmonton Lines: 11 something to say first... The problem is that getchar returns an int (not a char). I've never used either of the machines that you mention but my guess is that the Pyramid does sign extension on char to int conversions and the 3B2 doesn't. Since EOF is an integer (-1), the value 0xff gets assigned to your variable 'c'. When you compare this character with EOF (-1) on a machine that does sign extension, you get -1 vs -1. On a machine that doesn't do sign extension, you get 255 vs -1. The solution is simple - declare 'c' as an int instead of as a char.