invoke atodw, addr MyDWORD, addr MyString


That's how I assumed it should work?
It doesn't seem to...
A 'lil help please:)
Posted on 2003-03-18 04:24:31 by Homer
Here is a quick example:




.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\masm32.lib

.data
string db '7546754',0
format db 'eax=%u',0
.data?
buffer db 12 dup(?)
.code
start:
invoke atodw,addr string ; eax=7546754
invoke wsprintf,addr buffer,addr format,eax
invoke StdOut,addr buffer
invoke ExitProcess,0
end start

Posted on 2003-03-18 04:52:17 by Vortex
thanks
i figured out that


invoke atodw, MyDWORD, addr MyString


works fine... for some reason the method doesn't want the address of the DWORD.
Posted on 2003-03-18 05:03:25 by Homer
The reason being that the return value can be dword and not a string. When working with strings, you need to know the address of the string.
Posted on 2003-03-18 06:52:39 by roticv
The atodw function from the MASM32.lib requires only ONE argument, i.e. the address of the alphanumeric string. It returns the dword binary result in EAX from where you can do whatever you want with it.

If you are using a atodw function from some other library, you should verify how many parameters are required, their type, and their order, i.e. learn how to use each library function properly.

Raymond
Posted on 2003-03-18 10:47:57 by Raymond
you're right, i musta been thinking of dwtoa
Posted on 2003-03-18 10:52:33 by Homer