I am trying to copy a file from one place to another (on the device) using C ++ / Qt
I tried QFile :: copy ("path1 / file", "path2");
I want to copy a file in path1 to path2. path2 has no file.
I just want to know if this is correct, because this code does not seem to work.
Also, should I open the file before trying to copy? Help is needed!
If you want to copy path1/filein path2with the same file name, you will want to do:
path1/file
path2
QFile::copy("path1/file", "path2/file");
Copy allows you to change the file name. Example:
QFile::copy("path1/file1", "path1/file2");
. , . , . QFile::rename() .
QFile::rename()