I want my programs path (argv[0]) to be passed to my _explode function. I wish that it's last entry will be the programs name. E.g. Myprogram.exe. Why wont it work?Code:#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
_explode(argv[0]);
system("pause"); //Yes... I know this is bad.
return 0;
}
void _explode(char arg[])
{
char delims[] = "\/";
char *result = NULL;
//char arg[] = "This \ is / a \message for you"; //this works
result = strtok(arg, delims);
while (result != NULL)
{
printf("Result is \"%s\"\n", result);
result = strtok(NULL, delims);
}
}
-Thanks.