Copy Files

How do i copy files using Visual C++.
(Note:- I want to copy the file itself and not it's content)
what do you mean with "I want to copy the file itself and not it's content" ?
I just did so many google searches and all I found about the topic was that they showed how to copy the content of the file using fstream.
The code is here:-
//start
std::ifstream ifs("input.txt", std::ios::binary);
std::ofstream ofs("output.txt", std::ios::binary);

ofs << ifs.rdbuf();
//end
I dont know whether the code works or not I want a code to copy the file itself(like when we select a file,right click on it and select copy) and not its content which the code does.
Last edited on
So you want to copy the file on the clipboard?
Read this documentation at MSDN: http://msdn.microsoft.com/en-us/library/ms648709(VS.85).aspx
I think he wants to move the file or make a copy of any file.

use CopyFile or CopyFileEx.

to move use rename()
Thanks. That's what I wanted.
Topic archived. No new replies allowed.