Hi all!
I need help in a small function to get a file back from a QFile that is in a QByteArray.
//----------Read File----------//
QFile file(ui.
lineEdit->text
());
// /home/user/fileIN.txt qDebug()<<"Error opening the file";
dataStream << file.readAll();
//---------Write File----------//
dataStream2 >> outFile;
QFile out
(ui.
lineEdit_2->text
());
// /home/user/fileOut.txt qDebug()<<"Error opening the file";
out.write(outFile);
//----------Read File----------//
QFile file(ui.lineEdit->text()); // /home/user/fileIN.txt
if(!file.open(QIODevice::ReadOnly))
qDebug()<<"Error opening the file";
QByteArray qba;
QDataStream dataStream(&qba, QIODevice::WriteOnly);
dataStream << file.readAll();
//---------Write File----------//
QByteArray outFile;
QDataStream dataStream2(&qba, QIODevice::ReadOnly);
dataStream2 >> outFile;
QFile out(ui.lineEdit_2->text()); // /home/user/fileOut.txt
if(!file.open(QIODevice::WriteOnly))
qDebug()<<"Error opening the file";
out.write(outFile);
To copy to clipboard, switch view to plain text mode
I have no clue how to get the from a qbytearray and write it to my disk. At the moment it does nothing...
I need this because a co-worker of mine that doesn't work with me anymore wrote a function that save files to a database in form a a BLOB and now I don't know how to get them back.
Thank you!
Added after 5 minutes:
Problem solved...I am so silly that I open the QFile file twice instead of the out...
thanks anyway
Bookmarks