• <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文件系統的例子
            在devc++下編譯需要2個庫一個libboostsystem一個libboostfilesystem
            基本的研發如下:
            #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)<<"字節"<<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文件系統還不錯
            要是再加入對壓縮包或者資源包的支持就更好了!

            posted on 2010-08-11 16:42 ccsdu2009 閱讀(762) 評論(0)  編輯 收藏 引用 所屬分類: boost庫等
             
            久久丫精品国产亚洲av| 狠狠色伊人久久精品综合网| 欧美性大战久久久久久| 久久久久久精品免费看SSS| 国内精品久久久久影院优 | 国色天香久久久久久久小说 | 中文字幕人妻色偷偷久久 | 亚洲综合伊人久久大杳蕉| 99国产精品久久| 欧美麻豆久久久久久中文| 狠狠色婷婷久久综合频道日韩 | 日本一区精品久久久久影院| 亚洲а∨天堂久久精品| 亚洲AV日韩AV天堂久久| 久久久久亚洲AV无码专区桃色| 色欲综合久久中文字幕网| 久久久久国色AV免费观看| 99久久99久久久精品齐齐| 中文字幕精品无码久久久久久3D日动漫 | 波多野结衣AV无码久久一区| 国产叼嘿久久精品久久| 性色欲网站人妻丰满中文久久不卡| 精品国产乱码久久久久久浪潮| 久久精品人人做人人爽电影蜜月 | 日韩久久无码免费毛片软件| 18岁日韩内射颜射午夜久久成人| 久久精品国产乱子伦| 国产精品青草久久久久福利99| 久久99国产精品久久久| 久久综合香蕉国产蜜臀AV| 7777精品伊人久久久大香线蕉 | 亚洲∧v久久久无码精品| 少妇无套内谢久久久久| 日韩中文久久| 区久久AAA片69亚洲| 天堂无码久久综合东京热| 亚洲?V乱码久久精品蜜桃| 久久精品国产一区二区三区| 久久久久婷婷| 亚洲日本va午夜中文字幕久久| 亚洲欧美另类日本久久国产真实乱对白|