Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

A silly QFile::exists() question



  • I'm just wondering it it's possible to use a function to check any file that starts with a defined name, like in linux. For example

    @
    if (QFile("MY FILE NUMBER*").exists()) {
    //CODE
    }
    @

    By this I want to check if there are any files that start whit the name "MY FILE NUMBRER", since my program could create: "MY FILE NUMBER 1" or "MY FILE NUMBER 2" or even "MY FILE NUMBER 3" and in any of those cases I want my < if > function, to return true.

    I don't know if you get me, since I'm not a natve English speaker, so please, if you can't understand me, just let me know.



  • You should probably use "QDir::entryList()":http://doc.trolltech.com/latest/qdir.html#entryList for that. It understands * and ? wildcards.

    (Nothing wrong with your English b.t.w.)



  • Tanks, I'LL CHECK IT OUT


Log in to reply