Sending data to LPT1 (printer) 
Author Message
 Sending data to LPT1 (printer)

I have been trying to figure this one out for several days, and I hope
someone can help me out.

I am trying to communicate with a Label Printer which is connected to
Parallel port (LPT1).  All works fine one my laptopt, but on the
production machine I get an error.

Here's the code:

Open "LPT1.PRN" for Output as #1
'
 Print #1,"This is a test"
'
Close #1

The error I get on the production machine says "File not found" or
something along the lines (sorry, don't have the exact error message
with me).

Now, I believe LPT1.PRN isn't actually a file per se, but rather a
reserved name for communicating with the Parallel Port (at an
abstraction level, similar to how UNIX works).

Any ideas why the production machine doesn't like this?  Why would it
seem as if it was looking for an actual file? And I wonder where on
earth one maps LPT1.PRN to the parallel port, etc.

Thanks,
-Cristian

--
Remove SPAMSUX from my email!



Thu, 12 Aug 2004 01:32:34 GMT  
 Sending data to LPT1 (printer)
Just open ltp1, why the .PRN extension?

Max Bolingbroke


Quote:
> I have been trying to figure this one out for several days, and I hope
> someone can help me out.

> I am trying to communicate with a Label Printer which is connected to
> Parallel port (LPT1).  All works fine one my laptopt, but on the
> production machine I get an error.

> Here's the code:

> Open "LPT1.PRN" for Output as #1
> '
>  Print #1,"This is a test"
> '
> Close #1

> The error I get on the production machine says "File not found" or
> something along the lines (sorry, don't have the exact error message
> with me).

> Now, I believe LPT1.PRN isn't actually a file per se, but rather a
> reserved name for communicating with the Parallel Port (at an
> abstraction level, similar to how UNIX works).

> Any ideas why the production machine doesn't like this?  Why would it
> seem as if it was looking for an actual file? And I wonder where on
> earth one maps LPT1.PRN to the parallel port, etc.

> Thanks,
> -Cristian

> --
> Remove SPAMSUX from my email!



Thu, 12 Aug 2004 02:18:48 GMT  
 Sending data to LPT1 (printer)

Quote:
> Any ideas why the production machine doesn't like this?  Why would it
> seem as if it was looking for an actual file? And I wonder where on
> earth one maps LPT1.PRN to the parallel port, etc.

It's down to the way DOS has always handled devices.  LPT1: is the first
parallel port, COM1: the first serial; the colon is optional when accessing
them most of the time.  COPY AUTOEXEC.BAT LPT1 should print AUTOEXEC.BAT,
for instance.  The mapping cannot be changed; the ports are numbered
according to their I/O addresses I believe.  DOS just ignored anything after
the . as far as I recall; this is even true in NT/Win2k, having just tested
it (COPY TEXTFILE LPT1.FOO works, and DIR LPT1 gives something rather
weird).

Now, in Windows 3.1 at least, there was a [Ports] section in WIN.INI, which
often listed LPT1.PRN in addition to LPT1.  Why, I have no idea, and why
some machines like it now and some don't, no idea either.  But if you try
Open "LPT1:" ... instead it ought to work on all systems with something
attached to the first parallel port.  A 'file not found' could occur if the
port wasn't installed, had been disabled, or possibly if it was busy.

--
Regards,
Ben A L Jemmett.
(http://web.ukonline.co.uk/ben.jemmett/, http://www.deltasoft.com/)



Thu, 12 Aug 2004 02:22:12 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need to send output to LPT1 to another printer

2. Sending data to LPT1

3. Help, How to send printer command to printer bypassing printer driver in vb

4. ver. 2 - determine LPT1 printer or computer name

5. I want to map a network printer to LPT1

6. Sending data to a printer (QBASIC)

7. Checking LPT1 for printer status?

8. How to send TextBox data to printer ?

9. Sending Data To The Printer

10. capturing LPT1 to printer(0)

11. capturing data sent to printer

12. Printing Directly to LPT1 avoiding the printer object.

 

 
Powered by phpBB® Forum Software