int mainLIOS() { const char *path = "/home/yan/file.txt"; int lastSlash = getLastIndexOf(path, '/'); char *subs = substr(path, lastSlash + 1, strlen(path)); std::cout << subs; return 0; }
char *wsky_path_removeExtension(const char *fileName) { ssize_t i = getLastIndexOf(fileName, '.'); if (i == -1) return wsky_strdup(fileName); return wsky_strndup(fileName, i); }
const char *wsky_path_getFileName(const char *path) { ssize_t i = getLastIndexOf(path, '/'); if (i == -1) return NULL; return path + i + 1; }