Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Overwriting files when copying using QFile

$
0
0
Here’s a code snippet that works fine provided the destinationFile doesn’t exist:                     QFile destinationFile, sourceFile;                     QDir destination("../CopiedFiles");                     QString fileName("MyData.dat");                     destinationFile.setFileName(destination.filePath(fileName));                     sourceFile.setFileName("../MainData/" + fileName);                     sourceFile.copy(destinationFile.fileName()); Is there any way to overwrite the file automatically, or would I have to go the long way around (checking if the destinationFile exists, and if it does, removing it and then copying)?

Viewing all articles
Browse latest Browse all 18427

Trending Articles