954,116 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

print to USB from Qbasic

I recently updated my system to XP-2 with a pentium III. I have a number of qbasic programs I developed to use in my hobbies and lo and behold, I can't print to my usb port. The programs run okay. I should think this is a problem that has been solved many times but I haven't run acrossed the answer. Perhaps print-to-file then open and print the file with notepad or something. Any ideas?

Thanks, Paul

paul2594
Newbie Poster
2 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

You might take a look at
USB Central
http://www.lvr.com/usb.htm

USBs like to use drivers.

vegaseat
DaniWeb's Hypocrite
Moderator
5,976 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,416
 

Thanks! i check it out but i think i found a solution and it was as i suspected with a little wrinkle thrown in that makes it easier. 1st - create a text file the with the SHELL command you can open wordpad with a /p and the file name and wordpad will open the file and send it to the default windows printer. i haven't developed the code yet so wish me luck.

Thanks for you help. paul

paul2594
Newbie Poster
2 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

Dear Paul,
this article might help: How to print from BASIC DOS to any Windows printer
Regards,
Davide

printfil
Newbie Poster
5 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

You can use LPRINT , can't you?

linux
Posting Shark
933 posts since Aug 2006
Reputation Points: 118
Solved Threads: 30
 
You can use LPRINT , can't you?


LPRINT is hardcoded to LPT1: (only) and doesn't offer a way to close the LPT port at the print job end, causing long delays in newer Windows systems. Changing "LPRINT" with "PRINT #" as explained in the article above is easy with a good text editor and solves both those problems.
Regards,
Davide

printfil
Newbie Poster
5 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

Thanks! i check it out but i think i found a solution and it was as i suspected with a little wrinkle thrown in that makes it easier. 1st - create a text file the with the SHELL command you can open wordpad with a /p and the file name and wordpad will open the file and send it to the default windows printer. i haven't developed the code yet so wish me luck.

Thanks for you help. paul


OPEN "O",1,"PRINT.TMP"
PRINT #1, "Just testing the code."
CLOSE 1
SHELL "C:\PATH\WORDPAD.EXE"

That's all there is to it.

RWGBob
Newbie Poster
2 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

OPEN "O",1,"PRINT.TMP" PRINT #1, "Just testing the code." CLOSE 1 SHELL "C:\PATH\WORDPAD.EXE"

That's all there is to it.


Oops!

SHELL "C:\PATH\WORDPAD.EXE PRINT.TMP"

RWGBob
Newbie Poster
2 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

SHELL "C:\PATH\WORDPAD.EXE"

That's all there is to it.


That's not enough. This way all the printer control codes embedded in the text would end up on paper.
You should create an RTF file for Wordpad instead of a TXT, and translate all the Bold, Condensed and other control codes sent by the Basic program into the corresponding RTF commands.
Regards,
Davide

printfil
Newbie Poster
5 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

I recently updated my system to XP-2 with a pentium III. I have a number of qbasic programs I developed to use in my hobbies and lo and behold, I can't print to my usb port. The programs run okay. I should think this is a problem that has been solved many times but I haven't run acrossed the answer. Perhaps print-to-file then open and print the file with notepad or something. Any ideas?

Thanks, Paul


reply: Try http://www.brothersoft.com/downloads/dosprint.html

I had the same problem, & this works for me. Good luck. Jack

Jackgrt
Newbie Poster
9 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

I recently updated my system to XP-2 with a pentium III. I have a number of qbasic programs I developed to use in my hobbies and lo and behold, I can't print to my usb port. The programs run okay. I should think this is a problem that has been solved many times but I haven't run acrossed the answer. Perhaps print-to-file then open and print the file with notepad or something. Any ideas?

Thanks, Paul

Try http://www.brothersoft.com/downloads/dosprint.html
It works for me! Jackgrt

Jackgrt
Newbie Poster
9 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

I recently updated my system to XP-2 with a pentium III. I have a number of qbasic programs I developed to use in my hobbies and lo and behold, I can't print to my usb port. The programs run okay. I should think this is a problem that has been solved many times but I haven't run acrossed the answer. Perhaps print-to-file then open and print the file with notepad or something. Any ideas?

Thanks, Paul

One way is to do a 'Print Screen' which copies the screen to clipboard, then paste into Paint or other graphic editor. You can print from there. For a formatted output, you'll need a line printer on a parallel port. There are converters on the market from parallel to USB, also. I'm hoping someone will respond with a way to get QBasic to drive the USB port, as I have the same problem.

verban
Newbie Poster
1 post since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

or, try "printfil" (shareware), even better, for me. good luck, Jack

Jackgrt
Newbie Poster
9 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

Read this, userport.zip worked for us to allow qbasic to work in windows xp to control the arrick robotics through the parallel port.

http://www.writelog.com/support/lpt_port_support_on_windows_nt.htm

Download userport.zip from here: http://www.embeddedtronics.com/design&ideas.html

nokki
Newbie Poster
2 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You