0

I'm using a CFileDialog dialog box to open a file in my program. When this file gets opened, I'd also like to save a copy of that file into the directory of my program. How can I do this?

This is how I' m opening the file:

CFileDialog fileDlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, "All Files (*.*)|*.*||", this);

Thanks for any help.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • 1
    The same way that you copy any other file when you know the path. That's all the `CFileDialog` gives you. See here: [In an MFC application, what's the easiest way to copy a file from one directory to another?](http://stackoverflow.com/questions/191980/in-an-mfc-application-whats-the-easiest-way-to-copy-a-file-from-one-directory-t) – Cody Gray - on strike Jul 14 '11 at 16:14

1 Answers1

2

The file dialog doesn't copy files. After it returns, you get the selected file, then use regular file copy API to copy the file.

Roel
  • 19,338
  • 6
  • 61
  • 90