Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!husc6!spdcc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.std.c Subject: Re: ANSI C and standard libraries Message-ID: <5689@haddock.ISC.COM> Date: 1 Aug 88 14:25:21 GMT References: <62114@sun.uucp> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 19 In article <62114@sun.uucp> swilson%thetone@Sun.COM (Scott Wilson) writes: >[On some deficient OS and/or C library, getchar() doesn't echo or allow >backspacing. Also scanf has the same problem.] > >(The way I solved this particular problem in LSC was to #undef >getchar, define it be "realgetc", and write realgetc to behave >like I thought it should. So getchar() was a macro? I bet your solution didn't solve the scanf() problem, then, unless you recompiled. >Writing realgetc was easy because fgets does echo characters and allow >character erase, so I would just fill a buffer with fgets and hand out one >character at a time when realgetc was called.) Now this *is* in violation of the Standard. All of the I/O functions are supposed to behave as if by repeated calls to fgetc/fputc. Echo and erase should either be enabled in getchar(), or disabled in fgets(). Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint