ROSE的博客

为计算机学习者量身打造化

boost::filesystem::exists()用法

struct tm *newtime;
char tmpbuf[128];
time_t lt1;
time(&lt1);
newtime = localtime(&lt1);
strftime(tmpbuf, 128, "%Y%m%d", newtime);
std::string path1 = tmpbuf;
namespace fs = boost::filesystem;
fs::directory_iterator end_iter;
std::string path2 = WebApp::instance().conf().get("root.webserver.stockurl", "");
app.logger().log("dir url : [%s] ", path2);
bool hashist = true;
std::string path = util::path_append(path2, path1);
app.logger().log("file url :[%s] ", path);
fPortfolioName = path;
bool direxst = false;
direxst = boost::filesystem::exists(path2);
if (path2 == "")
{
hashist = false;
app.logger().log("config is null!!!");
app.logger().log("please add your config!!!");
}
if (direxst == false)
{
hashist = false;
}
else if (hashist == true)
{
for (fs::directory_iterator iter(path2); iter != end_iter; ++iter)
{
if (fs::is_regular_file(iter->status()))
{
date_["Date"][iter->path().filename().string()]["name"] = iter->path().filename().string();
app.logger().log("per file url :[%s] ", iter->path().filename().string());
}
}
}
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_31558353/article/details/49907175
个人分类: boost库filesystem
上一篇记住密码功能 angular js实现
下一篇c++ 设置console字体颜色
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭