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. Writing to file but file is not created?
Qt 6.11 is out! See what's new in the release blog

Writing to file but file is not created?

Scheduled Pinned Locked Moved General and Desktop
14 Posts 4 Posters 2.9k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    Hi,

    What error does QFile return ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • IamSumitI Offline
      IamSumitI Offline
      IamSumit
      wrote on last edited by
      #5

      Hii pditty8811..
      Why r you using break over here ..it is illegal to use..
      I compiled and run your program it is working fine at my side ..and file is created too.Give a specified path to a file .

      Be Cute

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pditty8811
        wrote on last edited by
        #6

        Hi guys thanks for responding. The break is there because all of this is actually in a case statement. I pulled it out of the case and it still doesn't work. If I run file.exists(), the file exists, and it also shows me the absolutepath with FileInfo, but I am unable to find the file on my computer.

        What the hell is going on? I have hidden files shown and OS files unhidden.

        I'm stumped.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #7

          Again: what error does QFile::error() return if open fails ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pditty8811
            wrote on last edited by
            #8

            QFile::error returns 0

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pditty8811
              wrote on last edited by
              #9

              The open does not fail.

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pditty8811
                wrote on last edited by
                #10

                1

                1 Reply Last reply
                0
                • JKSHJ Online
                  JKSHJ Online
                  JKSH
                  Moderators
                  wrote on last edited by
                  #11

                  From the QFile documentation:[quote]QFile expects the file separator to be '/' regardless of operating system. The use of other separators (e.g., '') is not supported.[/quote]

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    pditty8811
                    wrote on last edited by
                    #12

                    [quote author="JKSH" date="1389414113"]From the QFile documentation:[quote]QFile expects the file separator to be '/' regardless of operating system. The use of other separators (e.g., '') is not supported.[/quote][/quote]

                    Tried it, no luck.

                    I'm using windows xp, and Windows 7. Both builds don't produce the file.

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      pditty8811
                      wrote on last edited by
                      #13

                      I FINALLY FIGURED IT OUT. It's and antivirus thing. AVAST wasn't letting me create the file. Shit balls. I wasted 2 days on that issue.

                      1 Reply Last reply
                      0
                      • JKSHJ Online
                        JKSHJ Online
                        JKSH
                        Moderators
                        wrote on last edited by
                        #14

                        Ouch! I'm glad you've found a solution.

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        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