C++学习

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  3 Posts :: 0 Stories :: 0 Comments :: 0 Trackbacks

常用链接

留言簿

我参与的团队

搜索

  •  

最新评论

阅读排行榜

评论排行榜

2009年9月18日 #

#pragma once
#ifndef get_all_dll_file_of_path_h
#define get_all_dll_file_of_path_h

#include 
<boost/filesystem.hpp>
#include 
<vector>
#include 
<string>
#include 
<iostream>

namespace fs = boost::filesystem;

void getAllFileOfPath(std::vector<std::string>& dllNames)
{

    std::
string strPath = "../debug/"/*"f:\\c++\\study\\debug\\"*/;

    fs::path fullPath(fs::initial_path());        
// 初始化为本项目路径
    fullPath = fs::system_complete(fs::path(strPath,fs::native));    //将相对路径转换为绝对路径

    
// 注:fullPath 使用相对路径、绝对路径都可行

    
if (!fs::exists(fullPath))            //路径是否存在
    {
        std::cout 
<< "找不到指定目录,请检查该目录是否存在:";
        std::cout 
<< fullPath.native_file_string() << std::endl;        // 输出路径名
        return;
    }

    
if (!fs::is_directory(fullPath))        // 是否是目录
    {
        std::cout 
<< "指定路径不是目录";
        std::cout 
<< fullPath.native_file_string() << std::endl;
        
return;
    }


    fs::directory_iterator end_iter;
    
for (fs::directory_iterator file_itr(fullPath); file_itr != end_iter; ++file_itr)
    
{
        
if (!fs::is_directory(*file_itr) && (fs::extension(*file_itr)==".dll"))        // 文件后缀
        {
            dllNames.push_back(file_itr
->leaf());    //获取文件名
        }

    }


    std::vector
<std::string>::iterator itr = dllNames.begin();
    
for (;itr != dllNames.end(); ++itr)
    
{
        std::cout
<<*itr<<std::endl;
    }

}


#endif //get_all_dll_file_of_path_h
posted @ 2009-09-18 11:13 holyhw 阅读(2676) | 评论 (0)编辑 收藏

2009年9月8日 #

     摘要: 1. 项目编译时的obj文件链接时有可能出现问题的地方。

2. 头文件中存在 具体函数实现、静态成员变量赋值 的处理办法。

3. 防止头文件多次加载的方法。  阅读全文
posted @ 2009-09-08 10:28 holyhw 阅读(185) | 评论 (0)编辑 收藏

2009年9月4日 #

     摘要: 初步接触多线程。
主要是一些线程的相关函数。  阅读全文
posted @ 2009-09-04 09:07 holyhw 阅读(386) | 评论 (0)编辑 收藏