delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/19/19:22:54

From: fred AT genesis DOT demon DOT co DOT uk (Lawrence Kirby)
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: A funny thing happened!
Date: Thu, 14 Aug 97 16:45:49 GMT
Organization: none
Message-ID: <871577149snz@genesis.demon.co.uk>
References: <33EE4447 DOT 24E09407 AT nospam DOT net> <871305859snz AT genesis DOT demon DOT co DOT uk> <33F0D3EA DOT 528A AT cs DOT com> <33F13D7F DOT 423B9280 AT alcyone DOT com>
Reply-To: fred AT genesis DOT demon DOT co DOT uk
Lines: 28
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <33F13D7F DOT 423B9280 AT alcyone DOT com>
           max AT alcyone DOT com "Erik Max Francis" writes:

>> One of the features of the stdout buffering in DJGPP is that if you call
>> an input function that reads from stdin, the buffer is automatically
>> flushed.  The following works perfectly, although it requires a carriage
>> return after the character is typed:
>> 
>>     printf( "Type a character:  " );
>>     getchar();
>
>This is actually assured by ANSI (7.9.3).  If this doesn't work your
>compiler is not ANSI compliant.

7.9.3 does *not* guarantee that stdout's buffer is flushed before a
character is read:

1. it doesn't guarantee that stdout refers to an interactive device

2. even if it does the stream can be line buffered and there is no
   new-line character being output above.

-- 
-----------------------------------------
Lawrence Kirby | fred AT genesis DOT demon DOT co DOT uk
Wilts, England | 70734 DOT 126 AT compuserve DOT com
-----------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019