Mail Archives: djgpp/1996/11/05/09:13:06
bitc wrote:
>>
>> Why doesn't the following function in DJGPP...
>> int main()
>> {
>> printf("Hello.");
>> getch();
>> }
>> [snip] when compiled under DJGPP, I get this:
>> {keypress}Hello. {exit}
>>
> 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)..
I think you got to use setvbuf or setbuf. I forgot myself. But you could
always do this instead.
printf( "Hello." );
fflush( stdout );
getch();
Incidentally, if you'd used an stdio function like say, getchar(); to pause
for input, it would have remembered to send pending output to the screen.
TG
- Raw text -