• <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庫等
             
            久久久午夜精品| 亚洲乱码中文字幕久久孕妇黑人| 久久久SS麻豆欧美国产日韩| 人妻中文久久久久| 久久天天躁狠狠躁夜夜不卡| 无码AV中文字幕久久专区| 国产精品99久久久久久董美香| 亚洲午夜久久久| 99久久99久久| 成人综合久久精品色婷婷| 77777亚洲午夜久久多喷| 一级女性全黄久久生活片免费 | 久久国产精品99精品国产| 91秦先生久久久久久久| 久久久久国产精品嫩草影院| 少妇久久久久久久久久| 久久久久久国产精品美女| 1000部精品久久久久久久久| 久久人做人爽一区二区三区| 狠狠久久综合伊人不卡| 久久精品aⅴ无码中文字字幕重口 久久精品a亚洲国产v高清不卡 | 97精品国产97久久久久久免费 | 国产精品伊人久久伊人电影| 亚洲精品乱码久久久久久久久久久久 | 91精品国产91久久久久福利| 久久天天婷婷五月俺也去| 国产精品成人精品久久久| 99国产精品久久| 九九久久自然熟的香蕉图片| 国产精品成人久久久| 久久一本综合| 久久久久国产| 久久亚洲天堂| 久久伊人五月丁香狠狠色| 性做久久久久久久久老女人| 久久高潮一级毛片免费| 九九久久精品无码专区| 91精品国产91热久久久久福利| 久久国产成人精品麻豆 | 久久久久九九精品影院| 久久精品国产精品亚洲艾草网美妙|