const char *get_filename_ext(const char *filename) {
const char *dot = strrchr(filename, '.');
if(!dot || dot == filename) return "";
return dot + 1;
}
printf("%s
", get_filename_ext("test.tiff"));
printf("%s
", get_filename_ext("test.blah.tiff"));
printf("%s
", get_filename_ext("test."));
printf("%s
", get_filename_ext("test"));
printf("%s
", get_filename_ext("..."));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…