Problem with CONSTANT

Previous topic - Next topic

Minion

Not sure if this is a bug or not, can anyone else confirm this for me ?

when using constant I get funny results.

I defined the following ....

CONSTANT CR$ = CHR$(13)

But whenever I use it in a string value, it returns the path for the EXE file i`m running :(

Using " "+CHR$(13) returns some very weird characters indeed :(

But if I use just " " it works fine.

Am I missing something here, or doing something wrong ? Or can I not set a constant to CHR$(13) ?

kanonet

I can confirm your problem and i know what it is:
You cant assign a function to a constant (cuz it may change in some situations), it need to be a constant expression. But here is your solution:
CHR$(13) = "\r"
CHR$(10) = "\n"

So just make it
COSTANT CR$ = "\r"
and it should work fine. ;)
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Minion

Spelndid stuff :) TY Kanonet. 30 years in the biz and I`m still learning new stuff daily :)

kanonet

Btw its called escape sequence, you can find a list here:
http://de.wikipedia.org/wiki/Escape-Sequenz
(german but you will find a english list somewhere in the internet too^^)
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64