Getchar w/wout echo

Richard A. O'Keefe ok at quintus.uucp
Tue Aug 23 07:50:19 AEST 1988


In article <65197 at sun.uucp> alanf%smile at Sun.COM (Alan Fargusson) writes:
>I have always thought that this was an omission in the stdio I/O library.
>If turning echo on and off was defined as part of fread, fwrite, printf, ...
>then there would be no problem.  As it is now you kind of take your chances
>with various version of UNIX, and non UNIX systems are hopeless (as far as
>portability that is).

(1) Don't forget, the C standard has to make sense on IBM mainframes,
    which do not use a character-at-a-time interface to their terminals.
(2) The dpANS makes it clear that fgets() and getchar() are supposed to
    do the same things (in general), so if one of them echoes and the
    other doesn't, that's broken.
(3) The story with respect to UNIX and MS-DOS is nowhere near as bad as
    has been made out: yes the terminal ioctl() calls differ between BSD
    and Sys V, but if you want to control features like echoing you
    should probably be using Curses, and while there are differences,
    they aren't _that_ great.  There are implementations of Curses for
    MS-DOS, and even VMS tries to support that interface.

I loathe Curses myself, but it _is_ a de facto standard, and is being
used successfully by a lot of applications programmers.  It seems to
me that the appropriate thing to do is to propose that Curses be part
of the next version of the C standard (perhaps as an optional module
so that IBM won't have to bring their operating systems into the '70s).



More information about the Comp.lang.c mailing list