Hey guyz,
is there a possibility to get a paths basename. For example:
.DATA
szPath DB "C:\folder1\folder2\file.ext", 0
...
.CODE
invoke BaseName, ADDR szPath
would store "file.ext" in eax register.
Maybe there is a macro?
Greetz DerCoder
Open \masm32\help\masmlib.chm there is a function called NameFromPath
WOOW Big thx for 1) the fast reply and 2) for the nice answer =)
Another option ;-)
include \masm32\MasmBasic\MasmBasic.inc ; Download (http://www.masm32.com/board/index.php?topic=12460)
Init
Inkey Mid$(CL$(), Rinstr(CL$(), "\")+1) ; CL$() means CommandLine$
Exit
end start
Or use from Shlwapi.lib PathFindFileName
PTSTR PathFindFileName(
__in PTSTR pPath
);
Invoke PathFindFileName,addr szPath
And other Path function in Shlwapi can your read here.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb773559%28v=VS.85%29.aspx
Or use my old code
invoke lstrlen,addr szPath
lea esi,szPath
add eax,esi
.while BYTE PTR [eax] != '\'
dec eax
.endw
inc eax
Greets,