From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <78b8a6f4e03e55b062b5f7ab8a09484f@quanstro.net> To: fernanbolando@mailc.net, 9fans@9fans.net From: erik quanstrom Date: Sun, 6 Jul 2008 18:14:26 -0400 In-Reply-To: <1d5d51400807061503u325857b4nf1b4b326a08876a1@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] APE printf difference Topicbox-Message-UUID: dca2edfc-ead3-11e9-9d60-3106f5b1d025 > Hi > > I am probably posting more noise, but shouldnt the code below print > the prompt first then ask for a char? It works fine under gcc. > > > #include > > int main() > { > printf("\nprompt"); > getchar(); > return 0; > } the output is buffered. i don't see a requirment to flush stdout or any other output stream in c99 or posix standard for fgetc, though i may have missed something. getchar is defined in terms of fgetc. i would think this code would reliably do what you wish: #include int main(void) { printf("\nprompt"); fflush(stdout); getchar(); return 0; } - erik