QB64 Print Using "\ \"

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
Nigel
Newbie
Posts: 1
Joined: Fri Jan 15, 2016 4:18 am

QB64 Print Using "\ \"

Post by Nigel »

I'm using QB64 version 1 on Windows 7 Professional SP1 Intel Xeon CPU E31245 3.3GHz
The following results in a type mismatch on line 3. Why?

x1 = 1543.238
tmp$ = "\ \"
PRINT USING tmp$; x1;

I really need to write to a file but cannot even get it to work on the screen.
I have several columns and rows of variable length figures to output to a file which I need to line up for readability with the headings. I have tried all sorts of configurations for this.
Any suggestions?

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

Re: QB64 Print Using "\ \"

Post by burger2227 »

You must use # digits instead to create string numbers in the template.

"\ \" is used for string values cut off over spaces + 2 for the \characters. IE it will not show longer strings fully.

template$ = "$$######,.##" ' sets $ sign to start of number with comma thousands and decimal point

See chart of USING character formats

USING also rounds decimal point values up like CINT to values according to decimal places desired.
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
Post Reply