Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!rutgers!mephisto!prism!gt5784a From: gt5784a@prism.gatech.EDU (Walter G. Reynolds (JJ)) Newsgroups: comp.sys.amiga Subject: Re: program question, stdin, stdout. Summary: the answer! Keywords: use fflush() Message-ID: <12230@hydra.gatech.EDU> Date: 6 Aug 90 04:39:38 GMT References: <2033@bnlux0.bnl.gov> <2953@awdprime.UUCP> <69@bcstarc.stgt.sub.org> Organization: Georgia Institute of Technology Lines: 29 In article <69@bcstarc.stgt.sub.org> root!bcstarc@nadia.UUCP (Frank Pecher) writes: >In article <2033@bnlux0.bnl.gov> kushmer@bnlux0.bnl.gov (christopher kushmerick) writes: [program deleted] >>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? [more stuff deleted] Try using fflush(). I use DICE, and I noticed that if you use several printf statements, and none of them have a newline, that they won't actually get printed until way too late.... I solved this problem by using fflush(stdout) What's happening, is that the data is getting sent to a buffer or something, and the buffer is never being physically (in C terms) written out to stdout. I hope this helps.. it fixed my problem under DICE..... Walter (JJ) Reynolds. -- This .signature is being released as ShareWare. This means that if you like it, you are morally obligated to send your .signature to me in return. Send your .sigs to: gt5784a@prism.gatech.edu. Any donations will be used for future .sig releases.