[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Copy and rename files

Posted on 1998-08-31
2
Medium Priority
?
517 Views
Last Modified: 2013-11-19
MFC doesn't seem to have any functions to copy files, only rename(at least for CFILE).  I don't want to use:

system( "copy * *" );

because it brings up a tacky DOS shell window.  What is the best way to copy and rename a file in MFC?
0
Comment
Question by:halen
2 Comments
 
LVL 7

Accepted Solution

by:
psdavis earned 200 total points
ID: 1321495
Sure, the CopyFile function copies an existing file to a new file.

BOOL CopyFile( LPCTSTR lpExistingFileName,
 // pointer to name of an existing file
 
LPCTSTR lpNewFileName,
 // pointer to filename to copy to
 
BOOL bFailIfExists
 // flag for operation if file exists
 
);
 
Also for rename, you have CFile::Rename( )

Phillip


0
 

Author Comment

by:halen
ID: 1321496
I knew it was something simple.  CopyFile even allows for renaming in the process.  Thanx...
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question