home *** CD-ROM | disk | FTP | other *** search
- title _kbdfly - C replacement for BASIC's INKEY$
- ;------------------------------------------------------------------------------;
- ; This program gives C a replacement for BASIC's INKEY$ statement.
- ; It's needed is because the extended keyboard characters
- ; such as PgUp, Home, etc. return 'unusual' information from the DOS
- ; interrupt. If the first character returned from certain DOS functions is
- ; a zero and the zero flag indicates that it is a valid character, then
- ; this means that a second interrupt needs to be performed to retrieve the
- ; extended code. Then the extended code must be communicated back to the
- ; caller separately from a normal code because the decimal value of some
- ; extended codes matches that of normal letters, e.g. Home key returns a
- ; decimal 71, which is also the capital G. The Home key returns the
- ; value on the second interrupt, where the G comes on the first. This
- ; is similar to having to test the length of INKEY$'s returned string in
- ;
- ; Also like INKEY$, if no character is present from the keyboard, control
- ; returns anyway and a zero is present as the returned value.
- ;
- ; Sample invocation from C is:
- ;
- ; extern char kbdfly();
- ; char extended_char;
- ; char waiting_char;
- ;
- ; waiting_char = kbdfly( &extended_char );
- ; if ( waiting_char )
- ; /* regular character was returned */
- ; else {
- ; if ( extended_char )
- ; /* extended character was returned */
- ; else
- ; /* no character was returned */
- ; }
- ;
- ;------------------------------------------------------------------------------;
- ; George Defenbaugh 10034 E. 29th St. Tulsa, OK 74129 918-622-7926
- ; 12/15/1985
- ;------------------------------------------------------------------------------;