Article View: comp.sys.ibm.pc
Article #42209Re: MS-DOS call to read without echo
From: William C. Marsh
Date: Mon, 12 Feb 1990 20:47
Date: Mon, 12 Feb 1990 20:47
25 lines
1553 bytes
1553 bytes
In article <1990Feb9.000950.11693@druid.uucp> darcy@druid.UUCP (D'Arcy J.M. Cain) writes:
>In article <1262@srhqla.SR.COM> tcm@srhqla.SR.COM (Tim Meighan) writes:
>
>I also used 0 to signify no character since it is an impossible return.
>It is slightly more intuitive and can save a memory fetch and a byte
>when comparing the return such as:
>
> if (c = get_key)
> process_key();
>
Unfortunatly, (and the Microsoft C library functions _bios_keybd use the
same assumption), a scan code of 0x0000 *IS* possible on a standard
keyboard. It is Ctrl-Break. If you use the above idea for reading
keys, if the user hits Ctrl-Break, you program will hang, since
the function get_key() will return zero when there is no key ready,
or if the user hit Ctrl-Break. -1 would be a much better return code,
since 0xFFFF *is not* possible.
--
Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@cod.nosc.mil
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh
"If everything seems to be coming your way, you're probably in the wrong lane."
Technical Details
Message-ID:
<1784@cod.NOSC.MIL>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!nosc!cod!bmarshReferences:
<1262@srhqla.SR.COM> <1990Feb9.000950.11693@druid.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!nosc!cod!bmarsh From: bmarsh@cod.NOSC.MIL (William C. Marsh) Newsgroups: comp.sys.ibm.pc Subject: Re: MS-DOS call to read without echo Message-ID: <1784@cod.NOSC.MIL> Date: 12 Feb 90 20:47:41 GMT References: <1262@srhqla.SR.COM> <1990Feb9.000950.11693@druid.uucp> Reply-To: bmarsh@cod.nosc.mil.UUCP (William C. Marsh) Organization: Naval Ocean Systems Center, San Diego Lines: 25