• <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庫等
             
            久久人人爽人人人人爽AV| 久久香综合精品久久伊人| 一本大道久久a久久精品综合| 国产精品永久久久久久久久久| 国产成人无码精品久久久免费 | 99久久免费国产精精品| 久久精品一本到99热免费| 72种姿势欧美久久久久大黄蕉| 99久久人人爽亚洲精品美女| 无夜精品久久久久久| 亚洲AV无码久久精品色欲| 91精品国产综合久久香蕉| 久久精品国产亚洲αv忘忧草| 九九精品99久久久香蕉| 久久无码国产专区精品| 中文字幕久久欲求不满| 亚洲精品tv久久久久久久久| 精品乱码久久久久久夜夜嗨| 久久久亚洲裙底偷窥综合| 久久se精品一区精品二区国产| 久久男人Av资源网站无码软件 | 日韩AV无码久久一区二区| 日本久久久久久中文字幕| 狠狠色丁香久久婷婷综合蜜芽五月 | 四虎国产永久免费久久| 久久婷婷五月综合色奶水99啪| 日本道色综合久久影院| 99久久777色| 久久精品国产亚洲AV电影| 一本久久综合亚洲鲁鲁五月天| 午夜不卡888久久| 久久这里只有精品首页| 国产精品久久波多野结衣| 亚洲综合熟女久久久30p| 久久久久免费精品国产| 国产精品久久久久久久久软件 | 久久人人爽人人澡人人高潮AV | 久久av无码专区亚洲av桃花岛| 伊人久久五月天| 国产精品久久久久免费a∨| 一级a性色生活片久久无少妇一级婬片免费放 |