// crt_renamer.c
/* This program attempts to rename a file named
* CRT_RENAMER.OBJ to CRT_RENAMER.JBO. For this operation
* to succeed, a file named CRT_RENAMER.OBJ must exist and
* a file named CRT_RENAMER.JBO must not exist.
*/
#include <stdio.h>
int main( void )
{
int result;
char old[] = "CRT_RENAMER.OBJ", new[] = "CRT_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 );
}
重命名一个文件的代码
最新推荐文章于 2024-05-19 15:05:21 发布