News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

converting a string to an integer

Started by Rain Dog, January 24, 2005, 12:06:01 AM

Previous topic - Next topic

Rain Dog

I was trying to work with the hval, sval,uval, val macros and I could not get any of them to work..


I have a string named op1 that holds the characters "5" and is zero terminated, yet all the above conversion macros yeild only 0

what is the correct syntax for these macros?

Ic3D4ne

Try the "atodw" proc.

Include C:\masm32\m32lib\atodw.asm

Just open that file in notpad, and read the proc instructions.

-Ic3D4ne

MichaelW

Here is an example (as a console app):

; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .486                       ; create 32 bit code
    .model flat, stdcall       ; 32 bit memory model
    option casemap :none       ; case sensitive
    include \masm32\include\windows.inc
    include \masm32\include\masm32.inc
    include \masm32\include\kernel32.inc
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\kernel32.lib
    include \masm32\macros\macros.asm
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
        string db "12345",0
    .code
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    mov   eax, uval(ADDR string)
    add   eax, 1
    print ustr$(eax)
    mov   eax, input(13,10,"Press enter to exit...")
    exit
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start

eschew obfuscation

Rain Dog

i had found the problem.

I did not use ADDR

ofg

Rain Dog,

  Take a look at also,"Iczelion Tutorials ch.31"
  String2Dword  procedure.