Mail Archives: djgpp/1995/08/08/02:08:48
Hi there,
I have a printf problem (or more to the point a problem that occurs when
printing text to the console) which seems to have popped up out of the
blue. It looks to me like a buffering issue.
I have some code :-
printf("Enter S for simulate or R for real > ");
key = getkey();
switch(key)
{
....
}
It only outputs the printf string after I press one of the appropriate keys.
I looked at the FAQ and it suggested cprintf, cputs or using the fflush(stdout)
to force the buffer's contents to the screen. These methods haven't work.
Am I misdiagnosing the problem or doing something wrong. I can't recall
having this problem with printf before. I even tried putting a \n at the end
of the string hoping it would flush the buffer.
Hope someone can help with this hopefully simple problem. Does V2 handle
buffered output any differently to V1. Should I be using cprintf instead of
printf as a rule. What about portability...
Regards
Brendan Simon
brendan AT rdt DOT monash DOT edu DOT au
- Raw text -