Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - keydos() set up dos keyboard driver http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 keydos()            Set up DOS keyboard driver
------------------------------------------------------------------------------
 Declaration
   io.hdr

 Syntax
   proc keydos extern

 Arguments
   None.

 Return
   None.

 Description
   The keydos() procedure channels keyboard input through DOS functions,
   allowing redirection of Force input at the DOS command line. The BIOS
   driver, keybios(), is the default keyboard driver.

   The Force library contains replaceable drivers for screen and keyboard
   I/O. The keybios() function retrieves keys from BIO,S while keydos()
   retrieves keys from DOS. Use keybios() when speed, size and dBase
   compatibility is important. Use keydos() when a program requires DOS
   redirection or piping.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   /*
   Redirect keyboard system through DOS so that this program can be used as
   a command line filter. This program converts all standard input to lower
   case. Use scrndos() to output characters through DOS.
   
   Compile and link the sample program to lower.exe. To use it, at the DOS
   prompt type:
   
   type anyfile.txt | lower
   */
   
   proc Test_keydos
   vardef
      byte bChar
      uint nBytes
   enddef
   keydos()                                // get input from STDIN
   scrndos()                               // and output through DOS
   do while fbread( STD_IN, bChar, 1 ) > 0
      if bChar >= 'A' .and. bChar <= 'Z'
         bChar := bChar - 'A' + 'a'
      endif
      fbwrite( STD_OUT, bChar, 1 )
   enddo
   endproc

   proc main
   Test_keydos()
   endproc

See Also: keybios()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson