### Function

# Gio File new_tmp_async

since: 2.74

#### Declaration

    void
    g_file_new_tmp_async (
      const char* tmpl,
      int io_priority,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description

Asynchronously opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) as g_file_new_tmp().

`tmpl` should be a string in the GLib file name encoding containing a sequence of six ‘X’ characters, and containing no directory components. If it is `NULL`, a default template is used.

Available since: 2.74

This function completes asynchronously. Use `g_file_new_tmp_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation.

#### Parameters

`tmpl`

  Type: `const char*`

  Template for the file name, as in g_file_open_tmp(), or `NULL` for a default template.

  The argument can be `NULL`.
  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.

`io_priority`

  Type: `int`

  The [I/O priority][io-priority] of the request.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, `NULL` to ignore.

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

`callback`

  Type: `GAsyncReadyCallback`

  A `GAsyncReadyCallback` to call when the request is done.

`user_data`

  Type: `gpointer`

  Data to pass to `callback`.

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