I understand Val() is able to replace the once necessary ValHex() procedure, but I am curious why every hex value I send to that procedure returns -19 as the result. I could not find the post where I got that valhex procedure but can find same procedure here in the PB forums under name Hex2Dec / How did it get so broken it always returns -19?
infratec wrote: Tue Oct 08, 2024 9:39 pm
Since a long time, strings are stored in unicode inside of PB.
Your code is for strings stored in ASCII format.
Ok, that explains it, I guess. Unicode is still a bit of a mystery to me.
yes I already tested and learned val() is functional as noted in my OP above.
THANKS infratec!!!
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Just another minor hint:
I would never define a structure within a procedure. Even if the compiler is fine with that.
Why?
This approach would suggest that the structure is local.
But it is not!
Therefore my recommendation: structure definitions belong at the beginning of the file (or at least the code.)
; inserted after the procedure to demonstrate what has just been written.
Define tt.OneByte
tt\a = 254
Debug tt\a
Just because it worked doesn't mean it works. PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Axolotl wrote: Wed Oct 09, 2024 10:48 am
Hi Randy,
Randy Walker wrote: Tue Oct 08, 2024 9:58 pm
Ok, that explains it, I guess. Unicode is still a bit of a mystery to me.
I would never define a structure within a procedure. Even if the compiler is fine with that.
I didn't put it there. It came that way when I only copied the code from one of the posts here in the forums. I thought it was a little strange to see the structure inside the procedure but it worked so I went with it as it was. Structures, Types and callbacks are all huge mysteries. Looking at threads now and that's got my brain majorly torqued. Anything more than a straight for next loop is a challenge. I feel really lucky when I get a Win API to work. My good old GFA Basic allowed me to do x = Not x to toggle a variable and now i'm lost because that doesn't work here.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Define x
x = #True
If x = #True
Debug "True"
Else
Debug "False"
EndIf
x = Bool(Not x)
If x = #True
Debug "True"
Else
Debug "False"
EndIf
x = Bool(Not x)
If x = #True
Debug "True"
Else
Debug "False"
EndIf