?
Solved

Copy and rename files

Posted on 1998-08-31
2
Medium Priority
?
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

741 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