N
Nagesh
hi,
I am want copy the command line arguments from szCmdLine of
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
int iCmdShow) into **char cmdLineParameter. So that I can use
cmdLineParameter in other functions. If any body knows pls help me
I am trying the following code sample:
char **cmdLineParameter;
int k=0;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
szCmdLine, int iCmdShow)
{
for (i = 0; i < strlen(szCmdLine); i++)
{
// Now check for command-line arguments
if (strncmp(&szCmdLine, "-pw", strlen("-pw")) == 0)
{
cmdLineParameter[k]=(char *)malloc(sizeof(char)*
strlen(&szCmdLine)));
strncpy(cmdLineParameter[k],&szCmdLine,strlen(&szCmdLine));
k++;
continue;
}
if (strncmp(&szCmdLine, "-vpw", strlen("-vpw")) ==
0)
{
cmdLineParameter[k]=(char *)malloc(sizeof(char)*
strlen(&szCmdLine)));
strncpy(cmdLineParameter[k],&szCmdLine,strlen(&szCmdLine));
k++;
continue;
}
etc....
}
}
thanking u,
Nagesh
I am want copy the command line arguments from szCmdLine of
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
int iCmdShow) into **char cmdLineParameter. So that I can use
cmdLineParameter in other functions. If any body knows pls help me
I am trying the following code sample:
char **cmdLineParameter;
int k=0;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
szCmdLine, int iCmdShow)
{
for (i = 0; i < strlen(szCmdLine); i++)
{
// Now check for command-line arguments
if (strncmp(&szCmdLine, "-pw", strlen("-pw")) == 0)
{
cmdLineParameter[k]=(char *)malloc(sizeof(char)*
strlen(&szCmdLine)));
strncpy(cmdLineParameter[k],&szCmdLine,strlen(&szCmdLine));
k++;
continue;
}
if (strncmp(&szCmdLine, "-vpw", strlen("-vpw")) ==
0)
{
cmdLineParameter[k]=(char *)malloc(sizeof(char)*
strlen(&szCmdLine)));
strncpy(cmdLineParameter[k],&szCmdLine,strlen(&szCmdLine));
k++;
continue;
}
etc....
}
}
thanking u,
Nagesh