fileOpenTmp

fnint fileOpenTmp(string tmpl, out string nameUsed)

Opens a file for writing in the preferred directory for temporary files (as returned by glib.global.getTmpDir).

tmpl should be a string in the GLib file name encoding containing a sequence of six 'X' characters, as the parameter to glib.global.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 glib.global.mkstemp (and mkstemp()) tmpl is not modified, and might thus be a read-only literal string.

Upon success, and if name_used is non-null, the actual name used is returned in name_used. This string should be freed with glib.global.gfree when not needed any longer. The returned name is in the GLib file name encoding.

Parameters

tmplTemplate for file name, as in glib.global.mkstemp, basename only, or null for a default template
nameUsedlocation to store actual name used, or null

Returns

A file handle (as from open()) to the file opened for

reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with close(). In case of errors, -1 is returned and error will be set.

Throws