Mail Archives: djgpp/1999/05/08/15:48:40
Hello Chong,
> Normally, we (at least I did :) would expect "Hello World" and "Sing
> along!" to be printed before the program pauses to wait for a keypress;
> The strange thing is, it doesn't. The program prints "Hello World" and
> then waits for a keypress before continuing to print "Sing along!". The
> problem can easily solved by replacing "getch();" with "Key = getch();"
> But why does it work this time? And the even stranger thing is that if I
> add a line feed i.e. "\n" at the end of the second output string, it
> works correctly too. Can anyone shed some light?
DJGPP's "cout <<" DO NOT PUT your string until it gets "\n" at the
end. It was made in order to speed up performance of output: in
protected mode realback calls (here is used DOS int 21h for output)
take a lot of time...
Best regards,
Alexander_Pankov mailto:billy AT dkd DOT ot DOT lt
* Origin: На С я могу писать ошибки, на С++ я могу их наследовать.
- Raw text -