I have
const char *pathname = \"..\\somepath\\somemorepath\\somefile.ext\";
how to transform that into
\"..\\somepath\\som
use strrchr() to find the last backslash and strip the string.
strrchr()
char *pos = strrchr(pathname, '\\'); if (pos != NULL) { *pos = '\0'; //this will put the null terminator here. you can also copy to another string if you want }