From: "A.Appleyard" To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Mon, 13 Nov 1995 09:21:52 GMT Subject: Re: stupid C question (flushing stdout) "J. A. McNamara" wrote:- > I find that when I do a printf, or putchar, nothing appears on the screen > until I send a "\n" to standard output ... So, is there any way to force the > buffer to flush to standard output without a newline? fflush(stdout); Also, in Gnu C/C++ stdout's buffer is automatically flushed when anything is read from stdin (usually = from the keyboard), so these will work:- printf("name of experiment?"); gets(exptname); double ask(char*s) {double x; char buf[512]; X: printf(s); gets(buf); if(sscanf(buf,"%lf",&x)<1) goto X; return x;} ... weight=ask("weight of sample?");