`Extra' newline when using getchar() (was: C Quirk??)
Ned Nowotny
ned at ghostwheel.UUCP
Sat Mar 26 10:16:06 AEST 1988
In article <596 at tuvie> rcvie at tuvie.UUCP (Alcatel-ELIN Forsch.z.) writes:
>In article <976 at mcgill-vision.UUCP> mouse at mcgill-vision.UUCP (der Mouse) writes:
>>> Since it sounds like you are wanting just one character at a time how
>>> about considering putting the system in raw mode so that when you do
>>> the getchar it comes right back at you. Why wait an force the user
>>> to hit a charrage return.
>>
>>Cbreak mode is probably better than raw mode. Have you ever written a
>>program that uses raw mode and then discovered a bug in the handling of
>>the command that's supposed to get you out? Great fun, isn't it?
>>
>
>Would all you ignorant UNIX-users out there please recognize that there exist
>other operating systems as well that cannot be put into `raw mode',
>`cbreak mode' or whatever! C is ***not*** expected to work solely under
>UNIX! [More flamage in the same vein deleted.]
Rather than flaming away, try giving an operating system independent method
of getting getchar() to return a character immediately upon typing the
character. When you fail, you might appreciate why people responded with
operating system specific solutions. Now, maybe you can come up with an
operating system independent replacement for getchar() with conditional
compilation for all known systems, but I would be surprised if even then you
could succeed in creating a universally portable method of handling character-
at-a-time I/O.
Discussing C issues independent of operating system is desirable, but some
issues (e.g. I/O) are necessarily operating system dependent. If you must
flame people for being too system oriented, consider the numerous messages
which debate the relative merits of Turbo C vs. Microsoft C. Certainly this
is more combustible material.
--
Ned Nowotny (ned at ghostwheel.aca.mcc.com.UUCP)
More information about the Comp.lang.c
mailing list