News:

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

String conversion problems

Started by miaomiao, March 01, 2012, 05:42:37 AM

Previous topic - Next topic

miaomiao

hi,all
    I have a question on string conversion   
eg:
   
   .data
       szbuf db 50 dup (0)
       szform db "%c",0
       str1 db "624E4373664D4747",0
       str2 db "bNCsfMGG",0
   .code
      ...   

    The str2 can converted to str1 by using  'invoke wsprinf addrszbuf...  ', Then how can I convert the str1 to str2?

   Thanks

hutch--

When you say "convert" are you just copying one string to another or are you modifying the string as well ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

miaomiao

hi,hutch--
   when changing "bNCsfMGG"to hexdata, the result is "624E4373664D4747".
   I just have got the idea, use the String convert Lib of Donkey, here is my codes

includelib Convert.lib

hex2dw PROTO :DWORD,:DWORD
.data
myvalue db "65443749",0
szBuffer db 20 dup (0)

.code
start:
    invoke lstrlen,addr myvalue
    invoke hex2dw,addr myvalue,eax
    lea esi,szBuffer
    mov dword ptr [esi],eax
    invoke ExitProcess,0
end start