You are here:

Qbasic, Quickbasic/LPRINT to 'wordpad' or 'notepad'


Can you PLEASE indicate how can I print directly to either  'wordpad' or 'notepad' from a quick basic program; I would rather print to 'wordpad' or 'notepad' rather than 'ltp-1'.

What I'm trying to do is, replace command 'LPRINT' with some other line which would re-direct the 'LPRINT' to 'wordpad' or 'notepad'.

Please, explain as much as possible with some examples.

Thank you,


Sorry for the late reply.  Do you mean you want to create rtf or txt files, or that you want to use Wordpad/Notepad to print?


---------- FOLLOW-UP ----------


I'd like to use Wordpad/Notepad to print: rather than print to my printer, I would like to write (in)to Wordpad/Notepad and then, send the Wordpad/Notepad to the printer or, transform Wordpad/Notepad into PDF format (I've got a software which does just that).

In other words, I'd like to send the 'output' of a QBasic program to Wordpad/Notepad, rather than 'LTP1'.  I have rtf/.txt files generated by the programs themselves!.


Hi Don,

I'm still a little confused, so I'm going to try and repeat what you are saying and tell me if I understand exactly what you're asking.

You have a program that currently prints a set of (text?) data using LPRINT to the printer.  Rather than print to your printer, you want your data to be "printed" into a PDF document, and you can currently do this through a printer driver that you can access through Notepad and Wordpad.

If that is the case, the first step you'll want to take is changing all of your LPRINT statements to PRINT # statements to be able to output your data to a file (your last statement is a little vague, so I'm not 100% sure if you've done this already).

So, let's pretend for a second that your output text file is ProgramOutput.txt

From here, you're going to want to send a command to window's command prompt.  To do this, we can use the SHELL command.

Doing a quick google search, I found some commandline options for WordPad.  It looks like we could do something similar to:

SHELL "write.exe /pt ProgramOutput.txt NameOfYourPdfPrinter"

I'm not 100% sure what your printer name will be, but if you tell me the driver you are using to print PDF files, I may be able to find that information for you if you cannot.  It may just take some trial and error, too, so don't be afraid to try something before asking me.

I hope that helps,

Qbasic, Quickbasic

All Answers

Ask Experts


Alex Barry


I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, QB64, c/c++, python, lua, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.


I have been programming in *Basic dialects since 2000, as mentioned in my expertise. After a year of QBasic, I learned C and C++, and dabbled a little in ASM (I don't program in ASM - I literally just played around to see how things work). When QB64 and FreeBASIC were released, I played with those languages. At the time, FreeBASIC offered more functionality and I sided with that language for a while. During that time, while I was learning new languages, that I would see what scripting languages are available, where I took up python and lua. I started to notice a staleness to QB64's development (which I kept tabs on from time to time), and am now trying to be active in it's community and maybe in it's development in the future. Currently, I am only active on the forums, but I appear on occasion on's forums as well.

Highschool - 2007

©2016 All rights reserved.