In an MFC application, what's the easiest way

2019-06-18 04:02发布

问题:

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?

回答1:

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



回答2:

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)