News:

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

prepend a string

Started by slovach, March 21, 2008, 08:14:48 AM

Previous topic - Next topic

slovach

Say I want to prepend what returns from something GetCurrentDirectory to another string? What's a good way to go about this?

u

:D appending it the other way, for instance.
Please use a smaller graphic in your signature.

jj2007

include \masm32\include\masm32rt.inc

.data?
buffer   db MAX_PATH dup (?)

.code

AppName   db   "Test app", 0
MyFile   db   "\MyParas.ini", 0

start:
   invoke GetCurrentDirectory, MAX_PATH-12, addr buffer
   invoke lstrcat, addr buffer, addr MyFile
   invoke MessageBox, NULL, addr buffer, addr AppName, MB_OK
   invoke ExitProcess, 0
end start

slovach

That was exactly what I was looking for, thanks.

herge

 Hi slovach:

You can also try:
The API GetModuleFileName
invoke GetModuleFileName,hInst,addr buffer,260]
// Herge born  Brussels, Belgium May 22, 1907
// Died March 3, 1983
// Cartoonist of Tintin and Snowy

evlncrn8

GetModuleFileName does NOT always give you the working directory.. especially if the working directory was set by a shortcut/lnk...
and you also have to trim the exe name from it...