GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Nov-2008, 15:34
Unit1 Unit1 is offline
New Member
 
Join Date: Aug 2006
Posts: 21
Unit1 is an unknown quantity at this point

How to change a filename


Hi all,

I would like to rename a bunch of filenames.

I use the following command to extract the file name:
CPP / C++ / C Code:
MyFileName = ExtractFileName(OpenDialog->FileName);
So, if I change the variable MyFileName, how can I update the filename of the file itself.

My idea is:

1) Open the file.
2) Extract the file name.
3) Change the file name.
4) ?????????.
5) Close the file.

Does someone have any idea which steps I should follow at item 4 to achieve this.

Thanks in advance.

Johan
  #2  
Old 08-Nov-2008, 18:54
dlp dlp is offline
Member
 
Join Date: May 2006
Posts: 157
dlp has a spectacular aura about

Re: How to change a filename


You need a function to change the name. If this is Windows, you can use MoveFile. Assuming MyFileName is a string of some kind, you'll need to store the new file name in a new variable, or else you'll lose the original file name.

Not knowing much about the environment you're using (ExtractFileName isn't a standard C++ function, nor is there a class in standard C++ that makes reference to dialogs), can't help you much more than that.
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help fixing my cash register program. lil_rom C++ Forum 5 11-Apr-2008 22:23
Exception in thread "main" java.lang.NullPointerException gedcraw555 Java Forum 3 25-Feb-2008 09:22
sudoku C++, need lots of help :S 3shtar C++ Forum 3 06-Apr-2006 11:10
Accumulating Sums boousaf C Programming Language 12 19-Oct-2005 14:27
Cuase the Windows OS to change a filename Dominic MS Visual C++ / MFC Forum 2 20-Sep-2005 15:56

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:16.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.