Previous Page
Next Page

rename

Renames or moves a file

#include <stdio.h>
int rename ( const char *oldname , const char *newname  );

The rename( ) function changes the name of the file specified by oldname to the string referenced by newname. The pointer argument oldname must refer to the name of an existing file.

The function returns 0 on success. If rename( ) fails to rename the file, it returns a nonzero value.

Example

See the example for remove( ) in this chapter.

See Also

freopen( ), remove( ), tmpnam( )


Previous Page
Next Page