c++判断是否为目录的示例分享
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:#include#includeintis_dir(char*path){structstatbuf;if(lstat(p...
复制代码 代码如下:
#include<sys/stat.h>
#include<unistd.h>
int is_dir(char *path){
struct stat buf;
if(lstat(path , &buf) < 0){
return FALSE;
}
int ret = __S_IFDIR & buf.st_mode;
if(ret){
return TRUE;
}
return FALSE;
}