c++判断是否为目录的示例分享
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;

}

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新C语言学习
热门C语言学习
编程开发子分类