Can we print using Qbasic

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
Guest

Can we print using Qbasic

Post by Guest »

Can weget Qbasic to print using a printer? If we can how?
User avatar
Pete
Site Admin
Posts: 887
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:

Post by Pete »

Yes, using the LPRINT command, though I think this is limited to printers connected to your computer through the parallel (LPT1) port.

LPRINT works just like PRINT. For example,

Code: Select all

LPRINT "Hello, how are you today?"
will print Hello, how are you today? on your paper.

As far as printing graphics and colors, I can't remember how to do it... and I'm not even sure if you can. Maybe one of these other nice people can fill us both in?
Anonymous

Post by Anonymous »

Pete wrote:As far as printing graphics and colors, I can't remember how to do it... and I'm not even sure if you can. Maybe one of these other nice people can fill us both in?
Printing graphics and colors requires you to know the escape codes of your printers manufacturer. Try to find them using google, then you can send these escape commands to the printer (using LPRINT as well, I thought) and it will execute the commands.

The commands differ per printer however, so if you want to make a program that prints out graphics, note that only your printer and similar printers will be able to print, other printers will either print random garbage or returns errors.
abionnnn

Colour printing

Post by abionnnn »

I had an example ages ago that did it for IBM-compatible printers. These are rare to find now, but it's quite similiar these days.

It'll be hard to make it portable unfortunatly since every printer manufacturer likes to make unstandardised crap. Maybe if you found out how to put various printers in postscript mode (if it existed) you'd have some luck =P

-abionnnn
Post Reply