_splitpath giving me errors!
Hello everyone!
Alright. Why does my program crash after this line?
Code:
char * getPartName(char * fileName, int part)
{
char *newName;
_splitpath("C:\\Documents and Settings\\Kixdemp\\Desktop\\Mythax\\screenshot.png", NULL, NULL, newName, NULL); // << This one
printf("Checkpoint!");
printf(newName);
return newName;
}
I get a "mythax.exe has encountered a problem and needs to close. We are sorry for the inconvenience." error... Why is it? Thanks!
BTW: Also, _splitpath is cross-platform, not just Windows, right? And, does the path have to be full? What if the user enters just a filename in the command line? (A file that's on the same dir.)