利用boost获取文件路径及其创建文件夹
#include<boost/filesystem.hpp>
……
// 获取应用程序所在的路径;
std::string exePath = boost::filesystem::initial_path<boost::filesystem::path>().string();
std::string file_path=exePath+"/jkjk";
// 检测文件夹是否存在,如果不存在就创建该文件夹;
if(boost::filesystem::exists(file_path))
{
//文件夹存在
std::string strPath = file_path.string();
int x = 1;
}
else
{
//文件夹不存在,创建该文件夹;
boost::filesystem::create_directory(file_path);
}
……