News:

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

String dificulties

Started by Farabi, May 01, 2005, 04:48:09 AM

Previous topic - Next topic

Farabi

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?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

MichaelW

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.
eschew obfuscation

AeroASM

You could also use lstrcat, but this is slow.

Vortex

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