我正在尝试通过目录进行迭代并捕获给定目录中的所有可用位图。
编译G ++ 6.2并更改我的RPI Zero上的SD卡后,我在设置boost::filesystem::direcotry_iterator itr(path)
以下是抛出段错误的代码:
boost::filesystem::path picturePath = "/path";
boost::filesystem::directory_iterator end_itr;
if (boost::filesystem::is_directory(picturePath))
{
for (boost::filesystem::directory_iterator itr(picturePath); itr != end_itr; ++itr)
{
do somthing with the files;
}
}
由于代码在两次更改之前工作,我相信代码仍然正确。但是为什么我在创建启动迭代器时会遇到段错误?