Problem storing backslash in a string.

Previous topic - Next topic


In my code I have:
Code (glbasic) Select
gkeyDesc$[86] = "\\"
It causes my app to close down as soon as it gets to that line. If I comment out that line, it works fine.
The same happens if I use "\"" to try and get a quote symbol into a string.

Using a single \ I get a syntax error when trying to compile. Am I making another school boy error?


Sure that the array is large enough to hold at least 86 indicies ?  That line should present no problem...


No MrTAToud, he is right. It doesn´t work.
But Bursar, you culd go the ASCII way.

CHR$(92)+CHR$(92) is the same as "\\"


Works fine here - hence the query about the array size...


check my web and/or my blog :D (devblog)
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Kitty Hello

"\" is a bug. You must escape the escape character. If you want "\" ou must type "\\", which is a bug, thus you mmust use char$(92) (only one!)


Yes, the array is big enough, it's been sized for 256 entries, and entries after that one are fine.

I've just deleted the line and retyped it, and now it's working. I wonder if maybe some odd invisible characters had got stuck onto the line, as it was part of a copy and paste operation. Before that, none of the suggestions were working either, and when I replaced "//" with "a", that also caused my game to exit out immediately. Very odd.

Anyway, problem solved for the time being :)


I think that sort of thing happened to someone a fair while ago...

Ian Price

QuoteI think that sort of thing happened to someone a fair while ago...
That was me a couple of months back - I had some characters in my text that appeared to be correct, but GLBasic didn't like them - and it was virtually impossible to tell they were different unless you copied them into another file (as in this forum) then back again. Removing them (and replacing) sorted the problem.
I came. I saw. I played.