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. Try create a file in a pen driver with full capacity used
Forum Updated to NodeBB v4.3 + New Features

Try create a file in a pen driver with full capacity used

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 1.7k Views 3 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.
  • M Offline
    M Offline
    Marcos Oliveira
    wrote on last edited by
    #1

    I try to create a file in pen driver that is complete full and the file was created, but the content is empty. There is a form to verify if the content of the file can be saved?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #2

      How do you write the file? Using QFile?

      M 1 Reply Last reply
      0
      • ? A Former User

        How do you write the file? Using QFile?

        M Offline
        M Offline
        Marcos Oliveira
        wrote on last edited by Marcos Oliveira
        #3

        @Wieland Yes, I am using Qfile. I am trying to show the message "The disk may be full or write-protected"

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          OK, so you use one of the various qint64 QIODevice::​write() functions. They all return the number of bytes that were actually written or -1 if an error occured.

          M 1 Reply Last reply
          0
          • M Offline
            M Offline
            mcosta
            wrote on last edited by
            #5

            Hi,

            if you're using Qt 5.4 you can use the QStorageInfo class to check the byteAvailables()

            Once your problem is solved don't forget to:

            • Mark the thread as SOLVED using the Topic Tool menu
            • Vote up the answer(s) that helped you to solve the issue

            You can embed images using (http://imgur.com/) or (http://postimage.org/)

            1 Reply Last reply
            0
            • ? A Former User

              OK, so you use one of the various qint64 QIODevice::​write() functions. They all return the number of bytes that were actually written or -1 if an error occured.

              M Offline
              M Offline
              Marcos Oliveira
              wrote on last edited by Marcos Oliveira
              #6

              @Wieland I am using QtextStream to put the content of the file. I did try to use the QFile::flush() method.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                @Marcos-Oliveira It's easy with QTextStream, too. After writing, obtain the status of the stream with Status QTextStream::​status() const and see if it's QTextStream::Ok or QTextStream::WriteFailed.

                M 1 Reply Last reply
                0
                • ? A Former User

                  @Marcos-Oliveira It's easy with QTextStream, too. After writing, obtain the status of the stream with Status QTextStream::​status() const and see if it's QTextStream::Ok or QTextStream::WriteFailed.

                  M Offline
                  M Offline
                  Marcos Oliveira
                  wrote on last edited by
                  #8

                  @Wieland Thanks, the problem was resolved :). Your help was of great value!

                  ? 1 Reply Last reply
                  0
                  • M Marcos Oliveira

                    @Wieland Thanks, the problem was resolved :). Your help was of great value!

                    ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    @Marcos-Oliveira Cool :-)

                    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