Qbasic, Quickbasic/LPRINT statements

Advertisement


Question
I have been using QBASIC for many years, but with my newer computers (from 1992 on)the LPRINT statements do not work.  I have gotten around the problem by using WRITE #1, but this does not allow the formatting of the output.  For example I cannot create a for-next loop to print a series of numbers in a single line.  

As an example:
F$ = "###,###,###,###,###,###"
 FOR i = 1 to 5
   x(i) = i^2
 NEXT i

 FOR J = 1 to 5
   LPRINT USING F$; x(j);
 NEXT J

 END  

Answer
Hi,

 Unfortunately this is just the way things are going. I'm now using VISTA which likes DOS less than XP did, and if/when W7 comes out I don't hold out much hope. As far as you're problem goes the only trusty solution I can think of that is going to work across all the different printers (remember they, too, aren't 100% compatible with each other) is to create the whole line of print using a string variable then print that variable.

 I don't know if this will help you or not but it's free so nothing is lost. Go to this URL and download DOSPrint.

http://www.powerbasic.com/support/downloads/files/DOSPrint.zip

 Hope this helps.  

Qbasic, Quickbasic

All Answers


Answers by Expert:


Ask Experts

Volunteer


Don Schullian

Expertise

I`ve worked in BASIC since the Commodore days and maintain a web site part of which is devoted to helping others with thier problems. I`m proficient in all versions of PowerBASIC but cross over to QuickBASIC and Qbasic frequently.

©2012 About.com, a part of The New York Times Company. All rights reserved.