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 - __prnhandle current printer device handle http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 __prnhandle         Current printer device handle
------------------------------------------------------------------------------
 Declaration
   printer.hdr

 Syntax
   uint __prnhandle

 Default
   STD_PRN (4).

 Description
   The __prnhandle system variable contains the handle of the currently
   initialized printer device. The handle is either a standard DOS I/O
   device number, or a file handle.

   The value of __prnhandle reflects the print device adjusted by
   the set printer to command. When the print device is PRN (the
   default), the value of __prnhandle is STD_PRN, that is 4. After changing
   the print device by the set printer to command, the value of
   __prnhandle becomes the file handle that DOS assigned to the new device.
   A file handle is assigned for LPT and COM printers as well as for disk
   files.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   vardef static
      byte aSend[ 5 ] := 27, 40, 49, 50, 85 // code to initialize HP III
   enddef
   
   proc Test_prnhandle
   vardef
      char cTemp
   enddef
   ? __prnhandle
   set printer to "test.txt"                // open file
   ? __prnhandle
   cTemp := "hello"
   fbwrite( __prnhandle, cTemp, 5 )         // write string to file
   set printer to                           // close file
   ? __prnhandle
   set printer to "LPT1"                    // open printer port
   fbwrite( __prnhandle, aSend[], 5 )       // initialize printer
   set printer to                           // close port
   endproc

   proc main
   Test_prnhandle()
   endproc

See Also: DOS handle table fbwrite() set printer to

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