GLBasic forum

Main forum => GLBasic - en => Topic started by: Synthetic on 2005-Dec-15

Title: Word variables and the backslash
Post by: Synthetic on 2005-Dec-15
I was working on some test code and found that a word variable doesn't like to hold backslashes.

In example:
textvariable$ = "\"

It didn't matter if it was mixed in with other characters either.

The compiler returned this:
C:\Program Files\GLBasic\Compiler\platform\gpc_temp.cpp:32: unterminated string or character constant
C:\Program Files\GLBasic\Compiler\platform\gpc_temp.cpp:17: possible real start of unterminated constant

Is this a bug or just a reserved character for the compiler?
Title: Word variables and the backslash
Post by: Kitty Hello on 2005-Dec-15
No, it's correct:
\" is the escape sequence for the " character. So you should write:
textvariable$="\"" // for a "
textvariable$="\\" for a \
Title: Word variables and the backslash
Post by: Synthetic on 2005-Dec-15
Ah, ok. That makes sense. Thanks for the fast reply!