Mail Archives: djgpp/1999/09/04/23:21:55
"Michael Nöthe" wrote:
>
> I bought a book on learning C++ and along with it I got a copy of
> the GNU-C++ Compiler V. 2.7.2.1 for DOS from DJGPP.
>
> In the book there was a sample program introducing encapsulated
> while-loops. A turning line (\|/-) should be shown on the screen.
> Now my problem is, the program doesn't seem to do anything !
> It compiles without any problems, but when I execute it, it shows
> nothing on the screen.
> After I finally use <CTRL+BREAK> to stop the programm, only the last
> charakter (e.g.: "\") is shown.
Your problem is not with the while loop. It is with the way stdout
buffers its output. To make your program work, you need to add a call
to
fflush(stdout);
after each call to
printf().
--
Weiqi Gao
weiqigao AT a DOT crl DOT com
- Raw text -