From: G DOT DegliEsposti AT ads DOT it To: djgpp AT delorie DOT com Message-ID: Date: Mon, 26 Jan 1998 10:10:34 +0100 Subject: Re: printf/getch problem Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Precedence: bulk > Whenever I have a printf before a getch, it waits until a key is >pressed before printing the string. However, if the string ends with a >\n it works fine. > >e.g printf("blah"); > getch(); > >will wait for a key to be pressed and then print "blah". If I replace >it with "blah\n" it works. > > Is this supposed to happen and if so how do I get around it? I've >tried the same thing with a borland compiler and it works as expected. This happens because the output is buffered, i.e. the chars are put on the screen after a whole line is printed (this explins why your code works with \n and doesn't without) You can override this using "fflush(stdout)", which outputs the output buffer even if it doesn't contain a whole line. ciao Giacomo