### Function

# GLib Dir make_tmp

since: 2.30

#### Declaration [src]

    gchar*
    g_dir_make_tmp (
      const gchar* tmpl,
      GError** error
    )

#### Description [src]

Creates a subdirectory in the preferred directory for temporary files (as returned by g_get_tmp_dir()).

`tmpl` should be a string in the GLib file name encoding containing a sequence of six ‘X’ characters, as the parameter to g_mkstemp(). However, unlike these functions, the template should only be a basename, no directory components are allowed. If template is `NULL`, a default template is used.

Note that in contrast to `g_mkdtemp()` (and mkdtemp()) `tmpl` is not modified, and might thus be a read-only literal string.

Available since: 2.30

#### Parameters

`tmpl`

  Type: `const gchar*`

  Template for directory name, as in g_mkdtemp(), basename only, 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.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gchar*`

The actual name used. This string should be freed with `g_free()` when not needed any longer and is is in the GLib file name encoding. In case of errors, `NULL` is returned and `error` will be set.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.