delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/19/10:00:13

From: Wilfried Hennings <nospam AT fz-juelich DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to open LPT1: as file?
Date: Wed, 19 Feb 2003 09:54:10 +0100
Organization: Forschungszentrum Juelich GmbH
Lines: 56
Message-ID: <qjf65vcq3mln2i56mbeufpkqgan86dm7vt@4ax.com>
References: <3E509273 DOT 2040107 AT fom DOT fgan DOT de> <3E50A19B DOT 8030906 AT geninfor DOT com> <Pine DOT WNT DOT 4 DOT 53 DOT 0302190837080 DOT 728 AT wat033>
NNTP-Posting-Host: mut011
Mime-Version: 1.0
X-Trace: zam602.zam.kfa-juelich.de 1045644853 449084 134.94.127.14 (19 Feb 2003 08:54:13 GMT)
X-Complaints-To: usenet AT fz-juelich DOT de
NNTP-Posting-Date: Wed, 19 Feb 2003 08:54:13 +0000 (UTC)
X-Newsreader: Forte Agent 1.92/32.572
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Wolfgang v. Hansen" <wolfgang DOT von DOT hansen AT fom DOT fgan DOT de> wrote:

> On Mon, 17 Feb 2003, Rafael García wrote:
> 
> > Wolfgang v. Hansen wrote:
> > > I tried to fopen("LPT1:", "w") but that didn't succeed.
> >
> > I ever use printers this way and it works perfectly.
> > Please tell us more about your configuration.
> 
> I think I found the reason why it didn't work. It seems that you have to
> have a printer driver configured for the port you wish to use. IMHO this
> is somehow odd, because I wanted to bypass any windows driver.

It isn't that odd for the WinNT/2000/XP line, as these systems do not
allow direct hardware access. I remember that for making a dongle
(hardware key) plugged in LPT1 work under NT, one had to install a
special driver for it.
On DOS/win3.1/win95/98/ME one can access the LPT port directly from the
command prompt. This eventually made the printer mix two print jobs. one
printed from Windows and one from a command prompt, printing a few bytes
from one job then a few bytes from the other, and so on, just as caused
by the task switching. Needless to say that the printout was completely
unuseable.
So since win95 there is an option to intercept command prompt printing
too by setting the port option "Spool DOS print jobs" (this is my guess
how it is called in English because I only have the German win98
available which calls it "DOS Druckauftrag zwischenspeichern").
One can also set the spool format to either "RAW" or "EMF".

On XP (should be not much different from 2000) I didn't see any such
option on printer - properties - ports - configure. I guess that command
prompt printing is always spooled. That may be the reason why it only
works if a printer is installed.
 
> BTW, does the generic text driver send all raw data to the printer
> correctly?

I don't think so. The generic text driver inserts at least line breaks
and page breaks according to the paper settings, and it has a code page
translation available.

But when printing from command prompt, the win driver isn't invoked but
only its spooling queue. If your print data gets corrupted, set the
spooling queue to "raw" format instead of "emf". In 2000/XP I guess it's
in the setting "printer properties - enhanced - activate enhanced print
functions". click on the "?" then on this setting and read what the help
sais.

Hope that helps.
--
email me: change "nospam" to "w.hennings"
Dipl.-Ing.(=M.Sc.Eng.) Wilfried Hennings c./o.
Forschungszentrum (Research Center) Juelich GmbH, MUT
<http://www.fz-juelich.de/mut/index.php?index=3>
All opinions mentioned are strictly my own, not my employer's.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019