Date: Tue, 08 Aug 1995 08:44:32 +0200 (MET DST) From: Christoph Kukulies Subject: Re: printf.help To: brendan AT rdt DOT monash DOT edu DOT au (Brendan Simon) Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Reply-To: Christoph Kukulies > > > 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 > "); >>>> fflush(stdout); <<<< > key = getkey(); > switch(key) > { > .... > } or use setbuf() (I believe) to set stdout to unbuffered. > > > 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 > > > > > > --Chris Christoph P. U. Kukulies kuku AT gil DOT physik DOT rwth-aachen DOT de FreeBSD blues.physik.rwth-aachen.de 2.2-CURRENT FreeBSD 2.2-CURRENT #0: Tue Jul 18 14:49:19 MET DST 1995 kuku AT blues DOT physik DOT rwth-aachen DOT de: /usr/src/sys/compile/BLUESGUS i386