I am trying to copy a file from one directory to another
Tried QFile::copy(). The file is copied but the size is zero Kb
Tried placing a dummy file and then replacing with original
But still the size is 0 Kb.
Qt Code:
QDir qd; QFile srcfile; QFile destifile; // dbsrcfilepath : "/Users/user/build-learnOn-Desktop_Qt_5_4_0_clang_64bit-Debug/learnOn.app/Contents/MacOS/learnOn1.sqlite" //dbdestinationfilepath : "/Users/user/learnOnContent/learnOn.sqlite" srcfile.setFileName(dbdestinationfilepath); destifile.setFileName(dbsrcfilepath); if(!srcfile.exists()) { bool success = true; qDebug()<<destifile.readAll().length(); success &= srcfile.write( destifile.readAll() ) >= 0; destifile.close(); srcfile.close(); } else { srcfile.copy(dbdestinationfilepath); }To copy to clipboard, switch view to plain text mode
The copy is not proper. File size is always 0.
Kindly help to resolve this issue.
Thanks in advance
Bookmarks