Solved

Copy and rename files

Posted on 1998-08-31
2
497 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 50 total points
Comment Utility
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
Comment Utility
I knew it was something simple.  CopyFile even allows for renaming in the process.  Thanx...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now