String to Dec?
TJHJ
Posts: 243
So maybe Im over thinking this, but I am reciving a string in 4 bytes.
Digit 1, 2, 3, 4 then print it to an LCD screen.
but I really want to use this number in calculations, so whats a good way to convert it back to a standard number/decimal.
Thanks as always,
TJ
Digit 1, 2, 3, 4 then print it to an LCD screen.
repeat 4 Rx := term.getc term.out(rx) lcd.str(@Rx)
but I really want to use this number in calculations, so whats a good way to convert it back to a standard number/decimal.
Thanks as always,
TJ
Comments
No documentation however, but its simple to use
Ask me if you need help.
Each method either takes a number and converts it to·a string and returns the pointer to the string. (Note the string last only until the library is called again.)
Or the methods take a pointer to a string and return the number of the string.
The decimal methods have a length part in them which specifies how many padded zeros you want.
Also, i've added in a hook to catch the quirker number -2147483648 which is equal to 2147483648 in binary (meaning that division with it gets &*^%$#) so the library is rather full proof.
There are also some timing methods.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/27/2009 8:11:52 PM GMT
Store the characters in the main memory, followed by a NULL or 0. And then call my library.
As in "1", "2", "3", "4", NULL(zero)
And then pass the libray the address of the "1", and it will return the number.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
TJ