I have a function and I want to use it but I dunno how to call it (I am a poor guy with having trouble that pointers)
please help me...
mmm... thanks!!
void MyClass:arseFilename(const char* fname, char** dir, char** name, char** ext)
{
// special case
if (fname == NULL)
{
if (dir != NULL) *dir = newstr("");
if (name != NULL) *name = newstr("");
if (ext != NULL) *ext = newstr("");
}
char* newfname = newstr(fname);
char* lastsep = strrchr(newfname, '\\');
char* lastdot = strrchr(newfname, '.');
if (lastsep != NULL) *lastsep = '\0';
if (lastdot != NULL && lastdot > lastsep) *lastdot = '\0';
if (dir != NULL) *dir = newstr(newfname);
if (name != NULL)
{
if (lastsep != NULL) *name = newstr(lastsep + 1);
else *name = newstr("");
}
if (ext != NULL)
{
if (lastdot != NULL && lastdot > lastsep) *ext = newstr(lastdot + 1);
else *ext = newstr("");
}
delete[] newfname;
}
please help me...
mmm... thanks!!
void MyClass:arseFilename(const char* fname, char** dir, char** name, char** ext)
{
// special case
if (fname == NULL)
{
if (dir != NULL) *dir = newstr("");
if (name != NULL) *name = newstr("");
if (ext != NULL) *ext = newstr("");
}
char* newfname = newstr(fname);
char* lastsep = strrchr(newfname, '\\');
char* lastdot = strrchr(newfname, '.');
if (lastsep != NULL) *lastsep = '\0';
if (lastdot != NULL && lastdot > lastsep) *lastdot = '\0';
if (dir != NULL) *dir = newstr(newfname);
if (name != NULL)
{
if (lastsep != NULL) *name = newstr(lastsep + 1);
else *name = newstr("");
}
if (ext != NULL)
{
if (lastdot != NULL && lastdot > lastsep) *ext = newstr(lastdot + 1);
else *ext = newstr("");
}
delete[] newfname;
}