简体   繁体   中英

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

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM