Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!saxony!dgil From: dgil@pa.reuter.COM (Dave Gillett) Newsgroups: comp.sys.ibm.pc.misc Subject: Re: Printer status from Turbo C Message-ID: <306@saxony.pa.reuter.COM> Date: 8 Aug 90 07:44:10 GMT References: <19721@orstcs.CS.ORST.EDU> Distribution: usa Organization: Reuter:file Inc (A Reuter Company) Palo Alto, CA Lines: 17 In <19721@orstcs.CS.ORST.EDU> duvalj@bionette.cgrb.orst.edu (Joe Duval - Entomology) writes: >I need a function that will tell me whether or not a printer is online. >It should be able to handle any possible port. Can I just call INT17 and >get the status from that? Will it work for any port? How do I specify the >port? INT 17H is the way to go. The "printer number" goes in DX. (PRN: is printer number 0. Why do I have this nagging suspicion that 0=LPT1, 1=LPT2, etc.? It feels right, but I don't have anything at hand to prove it....) AH needs to be 02H going in, and contains the status byte on exit. In my code, I consider the printer to be unavailable if bit 10H (Printer Selected) is off, or if either bit 20H (Out of Paper) or 08H (I/O Error) is on, and ignore all other bits. Note: DOS does an acceptible job of faking this service for LPT ports that are redirected to COM ports, so unless you want to provide XON/XOFF for serial printers, INT 17H is all you need. Dave