C语言-判断文件是否存在

1 bool file_exist(const char *path)
2 {
3     struct stat st;
4  
5     return (stat(path, &st) == 0) && (!S_ISDIR(st.st_mode));
6 }
原文地址:https://www.cnblogs.com/coolYuan/p/14360535.html