Hex numbers

 BBS: Inland Empire Archive
Date: 04-22-92 (14:10)             Number: 93
From: DAVID BLISS                  Refer#: 9
  To: MARSHALL EMM                  Recvd: NO  
Subj: Hex numbers                    Conf: (2) Quik_Bas
 > I can pull the 920509 out of the string version as a
 > decimal number and increment it to 920510, but how can
 > I get that treated as a hex number?

UnHEX.BAS
' <c> 1992 by Dave Bliss
' You can use this for anything but profit
x$ = COMMAND$
FOR x = LEN(x$) TO 1 STEP -1
a$ = MID$(x$, LEN(x$) - x + 1, 1)
IF a$ <= "9" THEN
        a = VAL(a$)
ELSE
        IF a$ = "F" THEN a = 15
        IF a$ = "E" THEN a = 14
        IF a$ = "D" THEN a = 13
        IF a$ = "C" THEN a = 12
        IF a$ = "B" THEN a = 11
        IF a$ = "A" THEN a = 10
END IF
tempvar = tempvar + (a * 16 ^ (x - 1))
NEXT x
PRINT tempvar

You can put this in a function then pull the decimal out of
the string, and increment the decimal, then call this
function to turn the decimal into hex (sorta)

Hope this helps,
Dave

---
 * Origin: The Aliens BBS, Simpsonville SC, 8032347195 (1:3639/4)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET