9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] APE question
@ 2001-10-12 14:32 rog
  0 siblings, 0 replies; 10+ messages in thread
From: rog @ 2001-10-12 14:32 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

i think on some platforms reading from stdin does an automatic flush on
stdout.  this might even be the standard.

anyway, it's probably safer to do

                printf("\nQuit [q], confirm [y], or change [menu] settings: ");   
                fflush(stdout);            
                /* read one char */
                ch = getchar();


[-- Attachment #2: Type: message/rfc822, Size: 1951 bytes --]

To: 9fans@cse.psu.edu
Subject: [9fans] APE question
Date: Fri, 12 Oct 2001 16:21:26 +0200
Message-ID: <cej-1011012162124.A01246@cejchan.gli.cas.cz>

Friends,

under APE, the following part of code:

                printf("\nQuit [q], confirm [y], or change [menu] settings: ");               
                /* read one char */
                ch = getchar();
 
does not print out the message before waiting for a character input, unless it is flushed
e.g. by adding 
	printf("\n");
before line 3. Is this an intention? If so, could you tell me a better workaround than this with blank printf()?

Sorry fot ignorance,
--peter.

--
Peter A Cejchan
biologist
Acad. Sci., Prague, CZ
<cej at cejchan dot gli dot cas dot cz>

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [9fans] APE question
@ 2001-10-12 14:33 pac
  2001-10-12 14:34 ` Boyd Roberts
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: pac @ 2001-10-12 14:33 UTC (permalink / raw)
  To: 9fans


>> 
>> Put an fflush(stdout) twixt the printf and getchar?
I'll give it a try. If only I were a bit better programmer to figure out that fflush() works with stdout, too (sigh, sigh)...

--cheers, peter



^ permalink raw reply	[flat|nested] 10+ messages in thread
* [9fans] APE question
@ 2001-10-12 14:21 pac
  0 siblings, 0 replies; 10+ messages in thread
From: pac @ 2001-10-12 14:21 UTC (permalink / raw)
  To: 9fans

Friends,

under APE, the following part of code:

                printf("\nQuit [q], confirm [y], or change [menu] settings: ");               
                /* read one char */
                ch = getchar();
 
does not print out the message before waiting for a character input, unless it is flushed
e.g. by adding 
	printf("\n");
before line 3. Is this an intention? If so, could you tell me a better workaround than this with blank printf()?

Sorry fot ignorance,
--peter.

--
Peter A Cejchan
biologist
Acad. Sci., Prague, CZ
<cej at cejchan dot gli dot cas dot cz>



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [9fans] APE question
@ 2001-10-12 14:14 presotto
  0 siblings, 0 replies; 10+ messages in thread
From: presotto @ 2001-10-12 14:14 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 53 bytes --]

Put an fflush(stdout) twixt the printf and getchar?

[-- Attachment #2: Type: message/rfc822, Size: 1864 bytes --]

From: pac <cej@cejchan.gli.cas.cz>
To: 9fans@cse.psu.edu
Subject: [9fans] APE question
Date: Fri, 12 Oct 2001 16:21:26 +0200
Message-ID: <cej-1011012162124.A01246@cejchan.gli.cas.cz>

Friends,

under APE, the following part of code:

                printf("\nQuit [q], confirm [y], or change [menu] settings: ");               
                /* read one char */
                ch = getchar();
 
does not print out the message before waiting for a character input, unless it is flushed
e.g. by adding 
	printf("\n");
before line 3. Is this an intention? If so, could you tell me a better workaround than this with blank printf()?

Sorry fot ignorance,
--peter.

--
Peter A Cejchan
biologist
Acad. Sci., Prague, CZ
<cej at cejchan dot gli dot cas dot cz>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-10-15  9:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-12 14:32 [9fans] APE question rog
  -- strict thread matches above, loose matches on Subject: below --
2001-10-12 14:33 pac
2001-10-12 14:34 ` Boyd Roberts
2001-10-12 14:40 ` Laura Creighton
2001-10-12 14:45 ` Howard Trickey
2001-10-12 14:58   ` Howard Trickey
2001-10-15  4:20     ` pac
2001-10-15  9:11 ` Douglas A. Gwyn
2001-10-12 14:21 pac
2001-10-12 14:14 presotto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).