Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!sdd.hp.com!usc!cs.utexas.edu!romp!auschs!awdprime!sabre.austin.ibm.com!robin From: robin@sabre.austin.ibm.com (Robin D. Wilson/1000000) Newsgroups: comp.sys.amiga Subject: Re: program question, stdin, stdout. Message-ID: <2953@awdprime.UUCP> Date: 30 Jul 90 14:17:03 GMT References: <2033@bnlux0.bnl.gov> Sender: news@awdprime.UUCP Reply-To: robin@reed.UUCP (Robin D. Wilson/1000000) Organization: IBM AWD, Austin, TX Lines: 24 In article <2033@bnlux0.bnl.gov> kushmer@bnlux0.bnl.gov (christopher kushmerick) writes: >#include stdio.h > >main() >{ > while ((c=getchar())!=EOF) putchar(c); >} >When I replace putchar with printf("%d\n",c) the program works as I woud >expect, it prints out the ascii value of the character I hit. > >Any ideas why the above prog should not work? Just a wild guess.. but maybe putchar() is trying to put a character, when "c" is an int? (I really don't remember.) +-----------------------------------------------------------------------------+ |The views expressed herein, are the sole responsibility of the typist at hand| +-----------------------------------------------------------------------------+ |UUCP: cs.utexas.edu!ibmchs!auschs!sabre.austin.ibm.com!robin | |USNail: 701 Canyon Bend Dr. | | Pflugerville, TX 78660 | | Home: (512)251-6889 Work: (512)823-4526 | +-----------------------------------------------------------------------------+