thanks Kennedy, but doing it with an array seems to work fine, I just looked at the decription of strdup, and I can't really be bothered doing it that way .
but I have ran into another pointer related problem .
I am starting to understand pointers alot better now, all this experience is surely helping. here is what I am doing:
Code:
p = PathFindFileName(szListData[0][0]);
strcpy(pfile->name, p);
MessageBox(NULL, pfile->name, NULL, MB_OK);
when I compile, it compiles 0 errors, 0 warnings, but when I run it, I get the error from Windows saying that the application needs to be closed.
p is declared:
name is declared:
Code:
char name[_MAX_FNAME];
when I try this:
Code:
p = PathFindFileName(szListData[0][0]);
MessageBox(NULL, p, NULL, MB_OK);
it prints the filename successfully without any problems.
can anyone please tell me why this is happening here? I really can't figure this one out, name is an array that obviously has _MAX_FNAME bytes allocated.