• <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 閱讀(768) 評論(0)  編輯 收藏 引用 所屬分類: boost庫等
             
            日本强好片久久久久久AAA| 漂亮人妻被中出中文字幕久久| 情人伊人久久综合亚洲| 热99RE久久精品这里都是精品免费| 国产免费久久精品丫丫| 久久综合九色欧美综合狠狠| 99精品国产综合久久久久五月天| 久久Av无码精品人妻系列| 国产99久久九九精品无码| 亚洲欧美伊人久久综合一区二区| 久久久中文字幕| 99精品久久精品一区二区| 久久夜色精品国产www| 久久国产欧美日韩精品| 国产成人精品久久| 国产精品va久久久久久久| 久久久久99精品成人片直播| 天堂无码久久综合东京热| 亚洲成色999久久网站| 97久久精品人妻人人搡人人玩| 久久人人爽人人人人片av| 久久久久99精品成人片三人毛片 | 狠色狠色狠狠色综合久久| 日韩欧美亚洲国产精品字幕久久久| 伊人久久免费视频| 2021久久精品免费观看| 情人伊人久久综合亚洲| 麻豆成人久久精品二区三区免费| 国产精品美女久久福利网站| 色婷婷狠狠久久综合五月| 久久夜色tv网站| 久久婷婷久久一区二区三区| 91精品国产综合久久精品| 999久久久免费精品国产| www性久久久com| 国产精品久久久久久影院| 久久一日本道色综合久久| 精品少妇人妻av无码久久| 亚洲国产精品人久久| 精品视频久久久久| 久久婷婷色香五月综合激情|