开发者

StlSoft - how to use their file system functionality?

开发者 https://www.devze.com 2023-02-06 10:34 出处:网络
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

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 rel开发者_StackOverflowating to the filesystem module.


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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消