How does one go about copying one binary FILE variable to another in C++?
Say I have the following:
1 2
FILE* tempFile; //is a binary file and assume already filled with contents
FILE* localFile;
tempFile, as the name implies, is stored in a temporary directory (AND has a randomized temp name) within Windows and I want to copy its contents to another file with a predefined name that is within a valid local directory (e.g. C:\Users\user\My Documents\test.exe). What do I have to use?
No, I want to remove my temporary file after its done copying its contents to the other file in the valid directory.
But wow, you brought up something of big interest. Don't know why that didn't even occur to me. How do I use rename()?
And also, if I do use rename(), does it support overwriting an existing file? Like if the user already has a file with the same name in the target directory, will running the program again (with the same target specified) overwrite the one that already exists with the new one?