• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            Cpper
            C/C++高級工程師 Android高級軟件工程師 IT集成工程師 音頻工程師 熟悉c,c++,java,c#,py,js,asp等多種語言 程序猿
            這是簡單的使用boost文件系統(tǒng)的例子
            在devc++下編譯需要2個(gè)庫一個(gè)libboostsystem一個(gè)libboostfilesystem
            基本的研發(fā)如下:
            #include <cstdlib>
            #include 
            <iostream>
            #include 
            <boost/filesystem.hpp>

            using namespace std;
            namespace fs = boost::filesystem;

            int main(int argc, char *argv[])
            {
                std::cout
            <<"sizeof(intmax_t)is:"<<sizeof(boost::intmax_t)<<'\n';
                fs::path path(
            "main.cpp",fs::native);
                
            if(!fs::exists(path))
                {  
                    
            return -1;                     
                }
                
            if(!fs::is_regular(path))
                    
            return -1;
                std::cout
            <<"size is:"<<fs::file_size(path)<<"字節(jié)"<<std::endl;    
                
                fs::path full_path(fs::initial_path
            <fs::path>());
                full_path 
            = fs::system_complete(fs::path("main.cpp"));  
                
            //! 獲取給定文件全路徑  
                cout<<"full path name is:"<<full_path.file_string()<<std::endl;
                
            //! 檢測是不是路徑
                cout<<"is path:"<<fs::is_directory(full_path)<<std::endl;
              
                unsigned 
            long file_count = 0;
                unsigned 
            long dir_count = 0;
                unsigned 
            long other_count = 0;
                unsigned 
            long err_count = 0;    
                full_path 
            = fs::system_complete(fs::path("C:\\WINDOWS"));
                
                
            //! 目錄迭代 
                fs::directory_iterator end_iter;
                
            for(fs::directory_iterator dir_itr(full_path);dir_itr != end_iter;++dir_itr)
                {
                   
            try
                   {
                      
            if(fs::is_directory(dir_itr->status()))
                      {
                          
            ++dir_count;
                          std::cout
            <<dir_itr->path().filename()<<"[directory]\n";
                      }
                      
            else if(fs::is_regular_file(dir_itr->status()))
                      {
                          
            ++file_count;
                          std::cout
            <<dir_itr->path().filename()<<"\n";
                          
            //! 全路徑名字 
                          std::cout<<dir_itr->path().native_file_string()<<std::endl;
                      }
                      
            else
                      {
                          
            ++other_count;
                          std::cout 
            << dir_itr->path().filename() <<"[other]\n";
                      }
                   }
                   
            catch(const std::exception & ex)
                   {
                      
            ++err_count;
                      std::cout
            <<dir_itr->path().filename()<<" "<<ex.what()<<std::endl;
                   }
                }
                std::cout
            <<"\n"<<file_count<<"files\n"<<dir_count<<" directories\n"<<other_count<<" others\n"<<err_count<<" errors\n"
                
                
            //! 生成文件目錄
                fs::create_directories(fs::path("filesystem"));
                system(
            "PAUSE");
                
            return EXIT_SUCCESS;
            }
            //! ccsdu2004 
            boost文件系統(tǒng)還不錯(cuò)
            要是再加入對壓縮包或者資源包的支持就更好了!

            posted on 2010-08-11 16:42 ccsdu2009 閱讀(766) 評論(0)  編輯 收藏 引用 所屬分類: boost庫等
             
            久久99精品久久久久久动态图 | 久久精品亚洲精品国产欧美| 欧美久久综合性欧美| 久久久久久久综合综合狠狠| 伊人久久大香线焦AV综合影院| 久久精品亚洲日本波多野结衣 | 久久99热国产这有精品| 久久国产成人| 国产成人久久AV免费| 亚洲精品视频久久久| 97久久精品人妻人人搡人人玩| 青青草原综合久久大伊人导航| 亚洲综合精品香蕉久久网| 三级韩国一区久久二区综合| 久久91亚洲人成电影网站| 国产aⅴ激情无码久久| 无码8090精品久久一区| 俺来也俺去啦久久综合网| 久久久久久久久久久久久久| 99久久无码一区人妻| 99久久久国产精品免费无卡顿| 精品久久久久久久久免费影院 | 久久久久久久波多野结衣高潮| 国产精品熟女福利久久AV| 国产精品久久久久久吹潮| 久久精品国产色蜜蜜麻豆| 久久久久久青草大香综合精品| 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久www免费人成看片| 国内精品伊人久久久影院| 亚洲国产精品一区二区三区久久| 9999国产精品欧美久久久久久 | 99久久99这里只有免费费精品| 无码超乳爆乳中文字幕久久| 精品国产乱码久久久久久呢| 久久久国产打桩机| 婷婷综合久久中文字幕蜜桃三电影| 久久久久青草线蕉综合超碰| 亚洲欧洲日产国码无码久久99| 亚洲伊人久久精品影院| 成人久久精品一区二区三区|