Mail Archives: djgpp/1997/01/29/00:15:51
xlysak <xlysak AT fi DOT muni DOT cz> wrote:
: Can someone help me ?
: In my program are two function - first is printf() and second is
: getch(),
: but - first is called getch() and then printf(). Ghosts in the GCC :-)?
: All examples showed bellow running correctly in Borland C++ 3.1.
: Thanks for all answers !
: Marian (xlysak AT informatics DOT muni DOT cz)
: example --->
: void main()
: {
: int ch;
: printf("Hi , ");
: ch = getch();
: }
: Output is (!) :
: (1) - wait for getch()
: (2) - Hi ,
You get problems when mixing stdio (buffered) and console io
functions, to fix this, you should call fflush(stdout) before
switching to c??? functions. Otherwise the output in flushed at the
end of the program (or if you write a newline), which mixes
everything.
bye, Alexander
--
Alexander Lehmann, alex AT hal DOT rhein-main DOT de | "On the Internet,
lehmann AT mathematik DOT th-darmstadt DOT de | nobody knows
lehmann AT usa DOT net (permanent forward) | you're a dog."
<url:http://home.pages.de/~lehmann/>
- Raw text -