问题
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