In an MFC application, what’s the easiest way to copy a file from one directory to another?

Should I create two CFile objects and copy one into the other character by character? Or is there something in the library that will do this for me?

Answer

I would just use the CopyFile Win32 API function, but the example code in the CFile::Open documentation shows how to copy files with CFile (using pretty much the method you suggest).