Try create a file in a pen driver with full capacity used
-
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?
-
How do you write the file? Using QFile?
-
@Wieland Yes, I am using Qfile. I am trying to show the message "The disk may be full or write-protected"
-
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. -
Hi,
if you're using Qt 5.4 you can use the
QStorageInfo
class to check thebyteAvailables()
-
@Wieland I am using QtextStream to put the content of the file. I did try to use the QFile::flush() method.
-
@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'sQTextStream::Ok
orQTextStream::WriteFailed
. -
@Wieland Thanks, the problem was resolved :). Your help was of great value!
-
@Marcos-Oliveira Cool :-)