[comp.os.msdos.programmer] Detecting a printer

ctl8588@star.tamu.edu (LAUGHLIN, CHET) (11/10/90)

I am upgrading/maintaining a program written in TurboC that uses
the BIOSPRINT function to print to a printer.  However, if a printer
is not attached it takes several seconds (10-30) before the program
gets an error code back.  What is a *quick* way to detect if a
printer is out there?  Below is a sample of the code used in the
program.

prog_print_char(c)    /* of course, no documentation...*/
   char c;
{
   return(biosprint(0,c,0));
}

thankyou
+---------------------------------------------------------------+
| Chet Laughlin                  CTL8588@RIGEL.TAMU.EDU         |
|   "I have no opinions as I          (128.194.4.4)             |
|    do not exist, my lawyers                                   |
|    told me so."                                               |
+---------------------------------------------------------------+

ts@uwasa.fi (Timo Salmi) (11/10/90)

In article <5493@lanl.gov> ctl8588@star.tamu.edu writes:
>I am upgrading/maintaining a program written in TurboC that uses
>the BIOSPRINT function to print to a printer.  However, if a printer
>is not attached it takes several seconds (10-30) before the program
>gets an error code back.  What is a *quick* way to detect if a
>printer is out there?  Below is a sample of the code used in the

One direction to go is to change the printer retry default times
(20) into a smaller value such as 3.  This solution is not, however,
specific to C.  But if you want such a facility anyway, it is
available as setprt.exe in /pc/ts/tsutld18.arc package by anonymous
ftp or mail server from uwasa.fi or Simtel20.  But this solution
probably won't satisfy you (although it solves the problem of the
printer response delay) since it won't give you a C code. 

...................................................................
Prof. Timo Salmi        (Moderating at anon. ftp site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun