GLib.freopen
Description: Reference for GLib.freopen

### Function

# GLibfreopen

since: 2.6

#### Declaration [src]

    FILE*
    g_freopen (
      const gchar* filename,
      const gchar* mode,
      FILE* stream
    )

#### Description [src]

A wrapper for the POSIX `freopen()` function. The `freopen()` function opens a file and associates it with an existing stream.

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

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.

`mode`

  Type: `const gchar*`

  A string describing the mode in which the file should be opened.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`stream`

  Type: `FILE*`

  An existing stream which will be reused, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

#### Return value

Type: `FILE*`

A FILE* if the file was successfully opened, or `NULL` if an error occurred.

The data is owned by the called function.
The return value can be `NULL`.