【C语言】——判断给定的路径是目录还是文件

来源:互联网 发布:linux tomcat7 log4j 编辑:程序博客网 时间:2024/05/29 14:01
#include <sys/stat.h>struct stat buf;stat(path, &buf);if(S_ISDIR(buf.st_mode))    printf("is directory\n");else    printf("is file\n");