Skip to content

QtWS: Super Early Bird Tickets Available!

  • 0 Votes
    15 Posts
    18k Views
    B

    QProcess has quite extensive support for synchronous use.

    #include <QCoreApplication> #include <QDebug> #include <QProcess> int main(int argc, char **argv) { QCoreApplication app(argc, argv); QProcess process; process.start("ls", {"-l"}); if (process.waitForFinished()) { qDebug() << "returned:" << process.readAllStandardOutput(); } else { qDebug() << process.errorString(); } process.start("ls", {"-l"}); while (process.waitForReadyRead()) { while (process.canReadLine()) qDebug() << process.readLine().trimmed(); } }
  • Using ifstream on a Mac

    Unsolved General and Desktop
    8
    0 Votes
    8 Posts
    3k Views
    miclandM

    @pacostacos said:

    I actually just added the file to first.app/MacOS/ and it worked.... How do I include files in QT so they end up over there? thanks

    Depending on what you want to achieve you can integrate the file as resource into your Qt application using the Qt resource system and access the file via qrc:/... so it will be available on all platforms via the same way (but only from inside our application).
    See http://doc.qt.io/qt-5/resources.html