QFile::copy("C:/file.txt", "D:/file.txt");
if(QFile::copy("C:/file.txt", "D:/file.txt")){ qDebug() << "File copied successfully"; } else { qDebug() << "Error copying file"; }This code uses QFile::copy to copy the file "file.txt" from the C:/ drive to the D:/ drive. It also includes error handling to print a message if there was an error copying the file. Package library: The QFile class and its functions are part of the Qt Core library. Therefore, in order to use QFile::copy, you will need to include the Qt Core library in your project.