Cross-platform way to get all files in directory in C++ besides boost

时间:2022-09-26 12:05:58

Is there other cross-platform way except using Boost to get all files in directory? opendir/readdir seems not working under Windows.

除了使用Boost获取目录中的所有文件之外,还有其他跨平台方式吗? opendir / readdir似乎无法在Windows下运行。

1 个解决方案

#1


3  

You can use the cross-platform framework called Qt. An example solution to your problem:

您可以使用名为Qt的跨平台框架。解决您问题的示例:

#include <QtGui>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QListWidget window;

    QDir dir("/");
    QStringList list = dir.entryList();

    window.addItems(list);

    window.show();

    return app.exec();
}

#1


3  

You can use the cross-platform framework called Qt. An example solution to your problem:

您可以使用名为Qt的跨平台框架。解决您问题的示例:

#include <QtGui>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QListWidget window;

    QDir dir("/");
    QStringList list = dir.entryList();

    window.addItems(list);

    window.show();

    return app.exec();
}