• 获取当前文件夹以及子文件夹下所有文件C++


    void getFiles( string path,vector<string>& files)
    {
        //文件句柄  
        long   hFile   =   0;  
        //文件信息  
        struct _finddata_t fileinfo;  
        string p;  
        if((hFile = _findfirst(p.assign(path).append("\*").c_str(),&fileinfo)) !=  -1)  
        {  
            do  
            {  
                //如果是目录,迭代之  
                //如果不是,加入列表  
                if((fileinfo.attrib &  _A_SUBDIR))  
                {  
                    if(strcmp(fileinfo.name,".") != 0  &&  strcmp(fileinfo.name,"..") != 0)  
                        getCacheFiles( p.assign(path).append("\").append(fileinfo.name));  
                }  
                else  
                {  
                    files.push_back(p.assign(path).append("\").append(fileinfo.name) );  
    
                }  
            }while(_findnext(hFile, &fileinfo)  == 0);  
            _findclose(hFile);  
        }  
    }
  • 相关阅读:
    爬虫大作业
    作业
    新练习
    爬虫新练习
    最新操作
    小练习
    Hadoop综合大作业
    理解Mapreduce
    熟悉常用的HBase操作
    第三章 熟悉常用的HDFS操作
  • 原文地址:https://www.cnblogs.com/xuandi/p/7229550.html
Copyright © 2020-2023  润新知