C 语言

关注公众号 jb51net

关闭
首页 > 软件编程 > C 语言 > c++判断目录

c++判断是否为目录的示例分享

作者:

这篇文章主要介绍了c++判断是否为目录的示例,需要的朋友可以参考下

复制代码 代码如下:

#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;
}

您可能感兴趣的文章:
阅读全文