Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. A silly QFile::exists() question
Forum Updated to NodeBB v4.3 + New Features

A silly QFile::exists() question

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    patowlmc
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      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.)

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • P Offline
        P Offline
        patowlmc
        wrote on last edited by
        #3

        Tanks, I'LL CHECK IT OUT

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved