Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there an 'unhex' command?
#1
Is there any commands that converts a hexidecimal value into just regular decimal value? By that I just mean numbers. If there isn't a command to do this, does anyone have any functions or routines to get the job done? Thanks!
quote="na_th_an"]
Greenday, Spice Girls... Can you tell the difference?
[/quote]
Reply
#2
It took me almost two months, I asked my computer teacher, and I finally managed to write a function that did it. Only to a few days later, discover the easy way.


Code:
t$=HEX$(31482)
t=VAL("&H"+t$)
PRINT t

Just put "&H" in front and do a VAL() on it...


That was one of those, smack-head-against-monitor moments.

Hope this helps.
Reply
#3
Woah!? That's it!? I thought it would take lines and lines of codes! Well thanks alot Z!re, this will help a lot...
quote="na_th_an"]
Greenday, Spice Girls... Can you tell the difference?
[/quote]
Reply
#4
But you aren't l33t unless you write a fully-optimized ASM function for converting hex strings to integers that executes in 5 clocks and fries eggs and bacon while composing an orchestra. Wink VAL() sucks, though. It's pretty slow and I think (not sure in QB) that it returns a DOUBLE, whereas in this case, you would probably want an INTEGER or a LONG.
Reply
#5
It doesent say anything in the helpfile about which format VAL returns... perhaps the MS developers got sick, and actually did something smart, and have it autochange the type depending on the VALed string? Or depending on the variable where it's going to be stored.. dunno.
Reply
#6
Quote:Or depending on the variable where it's going to be stored.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)