StlSoft - how to use their file system functionality?

流过昼夜 提交于 2019-12-11 14:14:08

问题


I'm trying to add portability to the file system in an application I wrote. To this end, I'm using stlsoft, but I can't figure out how to use anything. Is there a tutorial somewhere, or a relevant example? They have samples on the site, but as far as I can see none relating to the filesystem module.


回答1:


Well, Boost.Filesystem is good, but heavy (boost.filesystem + boost.system).

Here the simple "ls" utility as example:

#include <algorithm>
#include <iostream>

#include <platformstl/platformstl.hpp>
#include <platformstl/filesystem/readdir_sequence.hpp>

using platformstl::readdir_sequence;   

int main(int argc, char *argv[])
{
    readdir_sequence entries(argc > 1 ? argv[1] : ".", 
            readdir_sequence::files|readdir_sequence::directories);
    std::copy(entries.begin(), entries.end(),
            std::ostream_iterator<char const*>(std::cout, "\n"));
    return 0;
}

Also you can check recls (Recursive LS) project on Sourceforge for more details.




回答2:


...Eh, looks like I'll be using Boost instead.




回答3:


I don't know what exactly you are looking for but here is the documentation to the stlsoft filesystem module.



来源:https://stackoverflow.com/questions/4794755/stlsoft-how-to-use-their-file-system-functionality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!