|
-
May 4th, 1999, 03:47 PM
#1
Renaming directories?
Is there an MFC/Win32 command to rename a directory? The documentation says CFile::Rename won't do the job.
-
May 4th, 1999, 11:50 PM
#2
Re: Renaming directories?
Hi!
The rename or the _wrename function(defined in stdio.h) renames the file or directory specified by oldname to the name given by newname.
The prototypes are :
int rename( const char *oldname, const char *newname );
int _wrename( const wchar_t *oldname, const wchar_t *newname );
Example :
/* RENAMER.C: This program attempts to rename a file
* named RENAMER.OBJ to RENAMER.JBO. For this operation
* to succeed, a file named RENAMER.OBJ must exist and
* a file named RENAMER.JBO must not exist.
*/
#include <stdio.h>
void main( void )
{
int result;
char old[] = "RENAMER.OBJ", new[] = "RENAMER.JBO";
/* Attempt to rename file: */
result = rename( old, new );
if( result != 0 )
printf( "Could not rename '%s'\n", old );
else
printf( "File '%s' renamed to '%s'\n", old, new );
}
Refer the help for more info.
Do let me know if this solves your problem.
Regards,
Sukanya Swaminathan
Software Engineer
Aditi Technologies Pvt. Ltd
224/16,Ramana Maharishi Road,
Blr - 80
-
May 5th, 1999, 05:15 AM
#3
Re: Renaming directories?
Thanks! It worked out perfectly!
Regards,
Gabriel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|