GLib.rename
Description: Reference for GLib.rename

### Function

# GLibrename

since: 2.6

#### Declaration [src]

    int
    g_rename (
      const gchar* oldfilename,
      const gchar* newfilename
    )

#### Description [src]

A wrapper for the POSIX `rename()` function. The `rename()` function renames a file, moving it between directories if required.

See your C library manual for more details about how `rename()` works on your system. It is not possible in general on Windows to rename a file that is open to some process.

Available since: 2.6

#### Parameters

`oldfilename`

  Type: `const gchar*`

  A pathname in the GLib file name encoding (UTF-8 on Windows).

  The data is owned by the caller of the function.
  The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.

`newfilename`

  Type: `const gchar*`

  A pathname in the GLib file name encoding.

  The data is owned by the caller of the function.
  The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.

#### Return value

Type: `int`

0 if the renaming succeeded, -1 if an error occurred.