Echoing chars and input functions

Dave Sill dsill at NSWC-OAS.ARPA
Tue Aug 16 21:52:09 AEST 1988


reg%lti.UUCP at bu-it.BU.EDU (Rick Genter x18) writes:
>Scott Wilson quotes the "Lightspeed 3.0 Standard Libraries Reference:
>
>>      getchar() gets the next character from stdin.  The character
>>      is not echoed to stdout.
>
>and asks if this is fixed in ANSI C.  I haven't seen the most recent
>incarnation of the dpANS, but I certainly hope it doesn't address 
>echoing.  That is an operating system function; it has nothing to do
>with the buffered I/O library.

I agree with Lightspeed that characters gotten from standard input
from getchar should not be echoed to standard output.  It would be
incredibly stupid to echo my keystrokes to file or pipe.  Of course,
the correct thing to do is echo the characters to the screen, but only
if they were entered interactively.
 
I have a problem saying this is in the domain of the operating system,
though.  What good is it to have standardized I/O functions if they
aren't guaranteed to work similarly on all systems?  What, then, is
the portable way to input a character from standard input, echoing the
character to the screen when necessary?
 



More information about the Comp.lang.c mailing list