let's say i have a string and a byte buffer like that:
myString db "ABCDEFG",0
sndString db 15 dup(0)
how to copy all the letters that are in "myString" to "sndString" so, that after every letter there is a placeholder (ASCII 32).
i want "sndString" to look like this:
A B C D E F G
I already tried something, but it doesn't work, it crashes:
invoke StrLen,addr myString
mov ecx,eax
lea esi,myString
lea edi,sndString
.while ecx>0
xor eax,eax
lodsb
inc esi
stosb
inc edi
mov al," "
stosb
inc edi
.endw
hey safcon, i'm not sure but try the hex value for that space
Olli
no, that's not the problem cause i use
mov al," "
so the character is placed in al directly, i don't need to know if it is hex or dec. that's not important in this case....
try that :
mov esi,offset bfBuffer
mov edi,offset bfSecondBuffer
mov ah,' '
@@: lodsb
test al,al
jz @f
stosw
jmp @b
@@: and byte ptr ,0
it should work
(thanks again for the link on your site to mine =), i added a link to yours =))here's my version :)
mov esi, offset myString
lea edi, sndString
mov ecx, sizeof myString
.while ecx>0
mov al, byte ptr
stosb ; store a letter
inc esi ; next letter
mov al, " " ; add a space after adding a letter
stosb ; store space
dec ecx ;
.endw
this should work too :)
()
- clip
This message was edited by clip, on 4/22/2001 5:56:55 PM
ok, thank you all.