首页 > Windows开发 > 详细

获取Windows某一目录下的所有文件名

时间:2017-08-01 18:22:58      阅读:220      评论:0      收藏:0      [点我收藏+]
#include <sys/types.h>
#include <dirent.h>
 
 
std::vector<std::string> get_all_filename(char* dirname)
{
     DIR *dp;
     struct dirent* dirp;
     std::vector<std::string> filename_vector;
     if((dp = opendir(dirname)) == NULL)
     {
          printf("this dir maybe not exist");
     }
     while((dirp = readdir(dp)) != NULL)
     {
          filename_vector.push_back(dirp->d_name);
     }
     closedir(dp);
     return filename_vector;
}

获取Windows某一目录下的所有文件名

原文:http://www.cnblogs.com/fushou/p/7269951.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!