简体   繁体   English

如何使用 boost 获取当前文件路径?

[英]How can I get current file path using boost?

How can I get the current file path using boost?如何使用 boost 获取当前文件路径? Like in a.cpp, I can get就像在 a.cpp 中一样,我可以得到

/home/src/a.cpp /home/src/a.cpp

I can use _FILE_ macro to get this, but I can't use _FILE_ due to some reason.我可以使用_FILE_宏来获得这个,但由于某种原因我不能使用_FILE_

Any ideas?有任何想法吗?

I suppose you are looking for我想你正在寻找

#include <boost/filesystem.hpp>
    boost::filesystem::path full_path(boost::filesystem::current_path());

or或者

auto p = boost::filesystem::current_path()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM