Qbasic 1.1 to output to a .txt file How to

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
logamuthu
Newbie
Posts: 3
Joined: Fri Dec 21, 2012 2:33 pm

Qbasic 1.1 to output to a .txt file How to

Post by logamuthu »

I run a bill printing program - 16699cst.bas coded by me in qbasic 1.1 in a P4 legacy PC running MS DOS 6.22 and having Parallel port on board
and the program prints output (.dat file) to a parallel port Dot Matrix Printer (called DMP hereinafter).

The legacy hardware may fail any time and replacement may not be easily available in the market.

So I have to be prepared to migrate to newer PC architectures and 32 bit OSs.

I am able to run the above program in my Dell Inspiron One 2020 running Windows 7 32 bit.

But I am unable to get the program to print (.dat file) to a USB DMP in the new PC which has no parallel port..

I have tried to work around by taking the .dat file output by QB, copy and paste the lines into a .txt file created by Notepad and then printing the
text file to the USB DMP in the new PC. But this takes time. OK for an occasional bill but not good enough for a busy POS.

I have modified the QB prog and tried to to make it output to a .txt file which is printable by my USB DMP but it wouldn't.

I have come for help in this forum.

TIA!
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

If you were using LPRINT, you could change those commands to PRINT #1, "text"

Code: Select all

file$ = "PrinTest.txt"
text$ = "This is a test of printer in QB64"

OPEN file$ FOR OUTPUT AS #1

PRINT #1, text$

CLOSE #1

SHELL "CMD /C  start /min Notepad /p " + file$
OR you could use QB64 to compile your program code as is! QB64 will work with a USB printer.

Code: Select all

LPRINT "This is a test of QB64 in Windows 7 64 bit"
You may need to format it a little differently. You can use LPRINT USING to format the information too.

http://qb64.net/wiki/index.php?title=LPRINT_USING
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
logamuthu
Newbie
Posts: 3
Joined: Fri Dec 21, 2012 2:33 pm

QBASIC Questions & Answers

Post by logamuthu »

Thank you very much, burger2227!

I have read your answer - shall revert to you soon.

logamuthu
Post Reply