• <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++高級(jí)工程師 Android高級(jí)軟件工程師 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ò)
            要是再加入對(duì)壓縮包或者資源包的支持就更好了!

            posted on 2010-08-11 16:42 ccsdu2009 閱讀(762) 評(píng)論(0)  編輯 收藏 引用 所屬分類: boost庫等
             
            奇米影视7777久久精品| 久久精品亚洲一区二区三区浴池| 久久精品国产精品亚洲精品| 精品无码久久久久久久久久| 91精品日韩人妻无码久久不卡| 国产精品久久久久国产A级| 午夜久久久久久禁播电影| 久久香综合精品久久伊人| 国产毛片欧美毛片久久久| 色综合久久中文字幕综合网| 亚洲日本va午夜中文字幕久久| 亚洲成av人片不卡无码久久| 中文成人无码精品久久久不卡| 91麻豆国产精品91久久久| 久久精品国产亚洲av麻豆蜜芽| 久久久久久曰本AV免费免费| 浪潮AV色综合久久天堂| 91久久婷婷国产综合精品青草| 欧美日韩中文字幕久久伊人| 久久精品三级视频| 狠狠色综合网站久久久久久久高清| 热re99久久6国产精品免费| 久久国产精品久久精品国产| 国产免费久久久久久无码| 中文字幕精品久久久久人妻| 伊人久久大香线蕉亚洲五月天 | 久久久WWW成人免费精品| 日韩欧美亚洲综合久久影院Ds | 一本大道久久香蕉成人网| 久久精品人人做人人爽电影| 久久国产精品一国产精品金尊| 久久夜色tv网站| 久久精品免费一区二区| 久久久久中文字幕| 久久精品国产男包| 91精品国产综合久久精品| 久久人人爽人人爽AV片| 久久99精品久久久久久久久久| 国产精品九九久久免费视频| 亚洲日韩中文无码久久| 精品一久久香蕉国产线看播放|