From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Howard Trickey" To: <9fans@cse.psu.edu> Subject: Re: [9fans] APE question Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit In-Reply-To: Date: Fri, 12 Oct 2001 10:45:55 -0400 Topicbox-Message-UUID: 0750c3ee-eaca-11e9-9e20-41e7f4b1d025 > under APE, the following part of code: > printf("\nQuit [q], confirm [y], or change [menu] settings: "); > /* read one char */ > ch = getchar(); According to the C standard, "The standard input and output streams are fully buffered if and only if the stream can be determined not to refer to an interactive device." It doesn't say whether to use line buffering or no buffering in the interactive case. I chose line buffering. So the above might have worked if you'd put a '\n' at the end of the printf string. (But only "might": the code to test whether a file is "interactive" --- isatty --- is hacky in the extreme, and only works sometimes; with Plan 9's namespace stuff, it is hard to get right.) As well as the fflush solution given earlier, you could also put a call like setvbuf(stdout, _IONBF, BUFSIZ); near the beginning of your program. But the fflush solution is probably better.