rename()

The function renames a file.

Synopsis

intrename(stringoldFileName,stringnewFileName);

Parameters

Parameters Meaning
oldFileName Old file name
newFileName New file name

Return value

If the operation has been successful, the function returns 0 and in the event of an error, -1.

Error

Description

The function renames a file.

Example

Renames the file "description.doc" to "new_description.doc".

main()
{
  string oldFilNam = "C://Features/description.doc";
  string newFilNam = "C://Features/new_description.doc";
  rename(oldFilNam,newFilNam);
}

Assignment

File function

Availability

CTRL