Opens a temporary file.
See the mkstemp() documentation on most UNIX-like systems. This is a portability wrapper, which simply calls mkstemp() on systems that have it, and implements it in GLib otherwise.
|filename_template ||A string that should match the rules for mkstemp(), i.e. end in |
X string will be modified to form the name of a file that didn't exist.
- 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.
Definition at line 135 of file fileutils.cc.
const ScopedPtr<char> buf (g_strndup(filename_template.data(), filename_template.size()));
const int fileno = g_mkstemp(buf.get());
filename_template = buf.get();