How do you extract the base path from pathname in C?
Are there any functions built into the C language or the C-Runtime L
Before str is the full path and file name, after str is just the path:
str
char dir_ch = '\\'; // set dir_ch according to platform char str[] = "C:\\path\\to\\file.c"; char *pch = &str[strlen(str)-1]; while(*pch != dir_ch) pch--; pch++; *pch = '\0';