views:

2373

answers:

2

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?

+6  A: 

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).

jeffm
+1Don't forget that MFC is just a Win32 wrapper. When doing simple, low-level actions it's often most efficient to call the API directly.
Aidan Ryan
+1  A: 

It depends on what you want to do. There are a number of ways to copy files:

  • CopyFile()
  • CopyFileEx()
  • SHFileOperation()
  • IFileOperation (replaces SHFileOperation() in Vista)
skst