Is there any premade function for formatted converison of ascii $ to hex?

Started by ThoughtCriminal, July 13, 2005, 05:33:17 AM

Previous topic - Next topic

ThoughtCriminal

I'm currently using htodw from MASM32.  But I pretty sure it does not support:

0F0000000h
or
0xF0000000

Is the any that suppuort both of these formats?

Thanks.



GregL

ThoughtCriminal,

I just happened to write some procedures a few days ago. They are based on the C Run-Time Library sscanf function. The procedure is ahextoudword. It will accept "F0000000", "0xF0000000" or "0F0000000h". I was surprised it would accept the last one.

http://www.masmforum.com/simple/index.php?topic=1851.msg17554#msg17554


donkey

The hex2dw function in my convert.lib from my website will handle the following..

Quotehex2dw/hex2dwW
   Converts a HEX string to a DWORD value
   Parameters:
      pString = Pointer to a hex string
      cbLen = length of the string, NULL to have it measured
   Returns the DWORD value
   The function handles the following formats:
      0 to FFFFFFFF
      0h to FFFFFFFFh
      0H to FFFFFFFFH
      0x0 to 0xFFFFFFFF
      You can also put anything in front of the hex string, i.e.
      SOMECONST equ 0xFFFFFFFF

   Tested GoAsm & MASM
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable