May 4th, 1999, 03:47 PM
Is there an MFC/Win32 command to rename a directory? The documentation says CFile::Rename won't do the job.
|
Click to See Complete Forum and Search --> : Renaming directories? May 4th, 1999, 03:47 PM Is there an MFC/Win32 command to rename a directory? The documentation says CFile::Rename won't do the job. suganyas May 4th, 1999, 11:50 PM 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 Thanks! It worked out perfectly! Regards, Gabriel codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |