【问题标题】:StlSoft - how to use their file system functionality?StlSoft - 如何使用他们的文件系统功能?
【发布时间】:2011-01-25 14:39:35
【问题描述】:

我正在尝试在我编写的应用程序中为文件系统添加可移植性。为此,我正在使用stlsoft,但我无法弄清楚如何使用任何东西。某处是否有教程或相关示例?他们在网站上有示例,但据我所知,没有与文件系统模块相关的示例。

【问题讨论】:

  • 改用 Boost.Filesystem,它正在被维护并且有据可查。
  • 这不完全是我的决定......但如果我找不到像样的文档,我会这样做,是的。

标签: c++ stl filesystems


【解决方案1】:

嗯,Boost.Filesystem 不错,但是很重(boost.filesystem + boost.system)。

这里以简单的“ls”实用程序为例:

#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;
}

您还可以查看 Sourceforge 上的 recls(递归 LS)项目以了解更多详细信息。

【讨论】:

    【解决方案2】:

    ...呃,看来我要改用 Boost 了。

    【讨论】:

      【解决方案3】:

      我不知道您到底在寻找什么,但 here 是 stlsoft 文件系统模块的文档。

      【讨论】:

        猜你喜欢
        • 2013-10-19
        • 1970-01-01
        • 2018-05-12
        • 2012-10-16
        • 1970-01-01
        • 2020-07-09
        • 1970-01-01
        • 2020-04-09
        相关资源
        最近更新 更多