From: shade AT atrey DOT karlin DOT mff DOT cuni DOT cz (Ondrej Sury) Newsgroups: comp.os.msdos.djgpp Subject: Re: Using getch() in DJGPP Date: 26 Oct 1996 23:19:56 GMT Organization: L.O.G. Lines: 33 Distribution: world Message-ID: <54u6as$h7l$1@ns.felk.cvut.cz> References: <01bbbea6$206725e0$454fb7ce AT default> <3270CA8B DOT 41EE AT diku DOT dk> NNTP-Posting-Host: atrey.karlin.mff.cuni.cz To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp bitc wrote: > > Why doesn't the following function in DJGPP... > > int main() > { > printf("Hello."); > getch(); > } > > Now, in every other compiler I've seen, the binary will run like this: > > Hello. {keypress}{exit} > > But when compiled under DJGPP, I get this: > > {keypress}Hello. {exit} > > This isn't making sense to me. Why isn't the string printing until I press > a key? Shouldn't the program run in the order I wrote the instructions? > > Jake Harvey > jwharvey AT interaccess DOT com > AFAIK it's because stdout is buffered. Turn out buffering of stdout and it should work fine (But I can't remember how to do it).. -- ------------------------------------------------------------------------------- Blessed be, Moon Shade. An ye harm none, do what ye will. Hope never dies. -------------------------------------------------------------------------------