Printing from a DOS App to a USB port in Windows (98 or XP)

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Printing from a DOS App to a USB port in Windows (98 or XP)

Post by Zim »

How do I do that?

DOS editors like Dos Edit and QB are looking for LPT1: but the printer is on a USB port. Years ago I used a MODE command to map an LPT port to a serial (COM) port, but how do I map to a USB port so I can use my new printer with DOS programs?
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

When you install the printer (add a printer) you must click "Yes" to "Allow DOS programs to print" or something like that then set it to LPT:1, Then, you can just use the LPRINT statement.
Image
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Post by Zim »

Ok, I remember seeing that in Win95. I'll have to look for it in Win 98/XP. My son installed the printer so I'll bet he can help.

Thanks a lot!
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
Antoni
Veteran
Posts: 132
Joined: Wed Jun 15, 2005 3:01 pm
Contact:

Post by Antoni »

If this don works you can print to a file then shell to notepad with /p option

Code: Select all

shell "notepad /p yourprintfile.txt"
This should work with any printer that works in Windows.
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Using Notepad

Post by Zim »

Actually, this is a good solution, and one which I tried. I sent my output to a text file and opened it using Windows Notepad with the intention of printing from there.

Problem is, my program's output contained hi-bit Ascii characters for line drawing. In NotePad, these characters look like special (foreign) characters 'n stuff, but not lines. And that's the way they'd print too.

But thanks, anyway! Since the advent of Windows I try to NOT use upper Ascii graphics characters so that my files print the same from both DOS and Windows.

Note: what I actually ended up doing was installing a special "DOS Video Terminal Font" in Windows so that the line-drawing characters showed up correctly, then I printed from Notepad.
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Re: Using Notepad

Post by moneo »

Zim wrote:......
Problem is, my program's output contained hi-bit Ascii characters for line drawing. In NotePad, these characters look like special (foreign) characters 'n stuff, but not lines. And that's the way they'd print too.
......
I had a similar problem years ago. Solutions:
1) On an option or switch in your program, strip the hi-bit on characters to be output.
2) Write a simple little program which inputs the text, strips the hi-bit of each character, and writes to a temp output file. This is what I ended up doing.
*****
Post Reply