Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change name on a .txt 1

Status
Not open for further replies.

Jiko

Technical User
Apr 5, 2002
35
SE
I have a file called "123.txt" and I want to change name to "AAA.txt" after i finished to write to "123.txt".
I mean I have closed the file "123.txt".
I can open it and read the file and write it to my new file, but can't I just copy the hole file? Or just change name, I don't need the first one any more.

I do this in a testdevice where I save a lot of data and if nothing goes wrong I just keep the file with the first name, but if a test goes wrong I want to change name on the file and save it on a different library.
Hope someone understand that I mean!
Thanks Mike
 
From the Platform SDK at msdn.microsoft.com
Code:
BOOL CopyFile(
  LPCTSTR lpExistingFileName, // name of an existing file
  LPCTSTR lpNewFileName,      // name of new file
  BOOL bFailIfExists          // operation if file exists
);

-pete
 
You will find it in "windef.h"
Code:
typedef int                 BOOL;

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top