C Programming/stdio.h/tmpfile

In computing,  is an ISO C/POSIX function for creating a temporary file, a computer file which ceases to exist when the program, which opened the file, closes it or terminates.

Inclusion

 * C
 * C++

Semantics
The function  reports a pointer to a valid file stream on success; on failure, it returns.

Error conditions
In addition to returning,   sets   on failure. The permissible values of, if   fails, are:
 * - if a signal was caught during the execution of tmpfile.
 * - if the maximum number of file descriptors and/or the maximum number of file streams has been reached (in the process).
 * - if the maximum allowable number of files is currently open (in the system).
 * - if there is no space in the file system for creating the temporary file.
 * - if the file is a regular file and the size of the file cannot be represented correctly in an object of type off_t.
 * - if there is insufficient memory for allocating the file stream.

Caveats
The  function is susceptible to a number of security vulnerabilities; use the non-portable   (UNIX) or   (MSVCRT) functions, instead, to avoid these issues.

The implementation of this function in Microsoft C run-time library tries to create the file in the root directory of the current drive and typically fails reporting "Access denied".