Ok i want to rename a file example:
C://test.txt to C://new.txt

Recommended Answers

int rename( const char *oldname, const char *newname );

Jump to Post

All 2 Replies

int rename( const char *oldname, const char *newname );

Here is an Example

/* rename example */
#include <stdio.h>

int main ()
int result;
char oldname[] ="oldname.txt";
char newname[] ="newname.txt";
result= rename( oldname , newname );
if ( result == 0 )
puts ( "File successfully renamed" );
perror( "Error renaming file" );
return 0;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.