GLib.chmod
Description: Reference for GLib.chmod

### Function

# GLibchmod

since: 2.8

#### Declaration [src]

    int
    g_chmod (
      const gchar* filename,
      int mode
    )

#### Description [src]

A wrapper for the POSIX `chmod()` function. The `chmod()` function is used to set the permissions of a file system object.

On Windows the file protection mechanism is not at all POSIX-like, and the underlying `chmod()` function in the C library just sets or clears the FAT-style READONLY attribute. It does not touch any ACL. Software that needs to manage file permissions on Windows exactly should use the Win32 API.

See your C library manual for more details about chmod().

Available since: 2.8

#### 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.

`mode`

  Type: `int`

  As in chmod().

#### Return value

Type: `int`

0 if the operation succeeded, -1 on error.