It is not easy handling a string on assembler. Does anyone know what function I shall use to unied a string?
example:
t db "d:\",0
t2 db "my.exe",0
How to make it become one string?
In the MASM32 library there is szappend, szCatStr, szMultiCat, ucCatStr, and ucMultiCat. As far as I know, for all of these procedures, the programmer is responsible for ensuring that the destination buffer is large enough to contain the concatenated strings.
You could also use lstrcat, but this is slow.
Hi Farabi,
Here is an example using szCatStr
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
t db "d:\",0
db 6 dup(0) ; 6 bytes for the string concatenation
t2 db "my.exe",0
.code
start:
invoke szCatStr,ADDR t,ADDR t2
invoke StdOut,ADDR t
invoke ExitProcess,0
END start