🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1501

Re: Can I Intercept Stuff Going To A Printer Into A file.??

#1501
From: Christian Blum
Date: Mon, 14 Sep 1992 15:50
42 lines
2577 bytes
hjanssen@cbnewse.cb.att.com (hank janssen) writes:
> For all you MSDOS wizards out there. Maybe a stupid question.
> I have an application that prints out data from a very old DB system.
> I need to get the output of a list from the database in a flat file.
> (THe database is very old, and i have no DB access routines)
> 
> I can print pre-made lists. But they always go to the printer.
> Is there aneasy way for me to intercept the stuff going to the printer
> and route it to go to a file.
> 
> The program directly prints to the printer port.

Depends highly on how the program accesses the printer port. If it
uses API interrupt 17h, it is possible (but tricky). If it writes
directly to the printer port... bad luck. If it uses the appropriate
DOS handle, it's quite easy.

To intercept INT 17h using a TSR program is rather easy, but writing
the characters to a file isn't, because DOS is not reentrant. Best
write the characters into a buffer, then quit the application and
write the data to a file.

If the program uses the DOS printer handle, simply close it and re-open it
with function 3Ch. Then call the application as a child program
via function 4Bh (?, look it up in R. Brown's list).

Both ways require a certain level of experience in assembler
programming.

--
---------------------------------------------------------------------
Christian Blum                   Universitaet des Saarlandes, Germany
Friedrich-Ebert-Str. 50          chbl@stud.uni-sb.de
W-6685 Heiligenwald              chbl@sbustd.rz.uni-sb.de
Germany

   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
   $$                                                                    $$
   $$     Bottom-up is a design method that consists of transforming     $$
   $$              a lot of small problems into a big one.               $$
   $$                                                                    $$
   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Technical Details
Message-ID: <1992Sep14.155031.19164@coli.uni-sb.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!sbsvax!coli-gate.coli.uni-sb.de!sbustd!chbl
References: <1992Sep10.023143.1711@cbnewse.cb.att.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!sbsvax!coli-gate.coli.uni-sb.de!sbustd!chbl
From: chbl@sbustd.rz.uni-sb.de (Christian Blum)
Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc.misc
Subject: Re: Can I Intercept Stuff Going To A Printer Into A file.??
Message-ID: <1992Sep14.155031.19164@coli.uni-sb.de>
Date: 14 Sep 92 15:50:31 GMT
References: <1992Sep10.023143.1711@cbnewse.cb.att.com>
Sender: news@coli.uni-sb.de (Usenet news system)
Organization: Studenten-Mail, Rechenzentrum Universitaet des Saarlandes
Lines: 42