delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/20/16:23:41

Newsgroups: comp.lang.c,comp.os.msdos.djgpp
From: atbowler AT thinkage DOT on DOT ca (Alan Bowler)
Subject: Re: A funny thing happened!
Message-ID: <EF82Et.or@thinkage.on.ca>
Sender: news AT thinkage DOT on DOT ca
Organization: Thinkage Ltd.
References: <871305859snz AT genesis DOT demon DOT co DOT uk> <33F0D3EA DOT 528A AT cs DOT com> <33F13D7F DOT 423B9280 AT alcyone DOT com>
Date: Wed, 20 Aug 1997 17:11:16 GMT
Lines: 26
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <33F13D7F DOT 423B9280 AT alcyone DOT com> Erik Max Francis <max AT alcyone DOT com> writes:
>John M. Aldrich wrote:
>
>> 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.

Not really.  It just may mean that the implementation doesn't have
anything that is an "interactive device" within the terms of the
standard.  The standard only specifies what features something must
have to be called an "interactive device", it does not require that
such a device exist in the environment.  It does not preclude the
existence of things that look very close to the "interactive devices"
of the standard but that can't be be called "interactive devices"
for technical reasons beyond the control of the C implementor.

Actually, it is not unknown for the above printf/getchar sequence to
work fine, but a printf/fflush/getchar sequence to fail (or seem to).

- Raw text -


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