Page 1 of 1

Qbasic 1.1 to output to a .txt file How to

Posted: Fri Dec 21, 2012 8:31 pm
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!

Posted: Sat Dec 22, 2012 12:34 am
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

QBASIC Questions & Answers

Posted: Sat Dec 22, 2012 3:24 am
by logamuthu
Thank you very much, burger2227!

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

logamuthu