Solved

Copy and rename files

Posted on 1998-08-31
2
503 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
matchUp  challenge 6 69
wordmultiple challenge 12 141
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 103
moto 4g phone enable finger print 4 26
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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 shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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