GLib.unlink
Description: Reference for GLib.unlink

### Function

# GLibunlink

since: 2.6

#### Declaration [src]

    int
    g_unlink (
      const gchar* filename
    )

#### Description [src]

A wrapper for the POSIX `unlink()` function. The `unlink()` function deletes a name from the filesystem. If this was the last link to the file and no processes have it opened, the diskspace occupied by the file is freed.

See your C library manual for more details about unlink(). Note that on Windows, it is in general not possible to delete files that are open to some process, or mapped into memory.

Available since: 2.6

#### Parameters

`filename`

  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.

#### Return value

Type: `int`

0 if the name was successfully deleted, -1 if an error occurred.