Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!snorkelwacker!ira.uka.de!smurf!nadia!bcstarc!root From: root@bcstarc.stgt.sub.org (Frank Pecher) Newsgroups: comp.sys.amiga Subject: Re: program question, stdin, stdout. Message-ID: <69@bcstarc.stgt.sub.org> Date: 1 Aug 90 23:43:12 GMT References: <2033@bnlux0.bnl.gov> <2953@awdprime.UUCP> Reply-To: root!bcstarc@nadia.UUCP (Frank Pecher) Organization: Boeblingen ComputerScienTific ARChive Lines: 22 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? I noticed the same problem; if you use putchar(), the output doesn't occur until you send an EOF. With printf() everything works alright. Maybe this problem is dependent on the compiler; I use Lattice 5.05. What compiler did you use? -- Frank -- Frank Pecher uucp: root@bcstarc.stgt.sub.org ==> (This line intentionally left blank) <==