PDA

Click to See Complete Forum and Search --> : Getting the command tail


Dec 5th, 2000, 06:12 PM
How do i get the command tail and parse it into an array, kinda like C++?

Dec 8th, 2000, 11:47 AM
How about a proc to return the command tail?

Sam Finch
Dec 8th, 2000, 02:15 PM
what's the command tail?

Dec 8th, 2000, 03:46 PM
C:\FOO\MAN\CHOO\MYPROG test.txt

Sam Finch
Dec 8th, 2000, 06:49 PM
ahh, you get a pointer to that in WinMain, say you use a standard C style procedure for WinMain (or whatever the starting procedure is) something like this


proc WinMain

push ebp
mov ebp, esp ;store the stack pointer in ebp
;so we can get at the parameters


;any code you need for your program


mov esp, ebp
pop ebp
ret 10;

endp WinMain


ebp is then a pointer to the bottom of the stack just after you pushed ebp

so ebp points to what is essentially a structure

struct
{
unsigned long Old_EBP;
void* Return_Address;
HINSTANCE hInstance;
HINSTANCE hPrevInstance;
LPSTR lpCmdLine;
int nCmdShow;
} Wot_EBP_Points_To;


so [ebp + 10h] is a pointer to a null terminated char array which contains the command tail, the string will stay in memory until the end of the winmain procedure, which should be the end of your program.

hope it helps

Dec 9th, 2000, 02:06 AM
Im doing it in dos, if i was using windows i would call "GetCommandLine".

Sam Finch
Dec 9th, 2000, 06:12 AM
oh, err, I don't know then