Tech Support Guy banner
Status
Not open for further replies.
1 - 4 of 4 Posts

·
Registered
Joined
·
703 Posts
Discussion Starter · #1 ·
I'm making a graphics demo in QBasic, and I'm having some troubles making it display some text I want.
So, I want to display this
The "place-read" mode has been turned on.
To do this, one would assume just do this.
Code:
PRINT "The "place-read" mode has been turned on."
But that doesn't work, because then QB assumes that place-read is a arithmatic string 'cuz the "s surrounding it make it a variable/command string. So, how do I display "s without ostracising what they surround from normal text?

... and yes, I am proud that I only know QB and HTML scripting. I don't mind being oldschool.
 

·
Registered
Joined
·
6,649 Posts
Just try this :
Code:
[SIZE=3][B]
LET Q$ = CHR$(34)
LET T$ = "The " + Q$ + "place-read" + Q$ + " mode has been turned on."
PRINT T$[/B][/SIZE]
34 is the decimal value of the ASCII code of "
 

·
Registered
Joined
·
12 Posts
Your original problem was caused by the qbasic interpreter assuming that the second " (the one at the beginning of 'place-read') signified the end of the string. In newer languages there's an escape character, usually \, that makes it ignore the following character, but in basic you have to call the ascii character instead of entering it directly.

BTW, qBASIC was my first language -- I started learning it when I was 12, and it hooked me on programming. That language first pulled me in, and I still enjoy it - although I can't say I use it for anything productive now.
 
1 - 4 of 4 Posts
Status
Not open for further replies.
Top