tmpfile
FILE * tmpfile ( void ); | stdio.h |
cplusplus.com |
Open a temporary file.
Creates a temporary binary file for update ( w+b mode -- see fopen for details). The filename is unique to avoid
any conflict with existing files.
The temporary file created is automatically deleted when it is closed (fclose)
or when the program terminates normally.
Parameters.
Return Value.
If successful, the function returns a file pointer (stream) to the temporary
file created.
If the file can not be created a NULL pointer is returned.
Portability.
Defined in ANSI-C.
Example.
/* tmpfile example */
#include <stdio.h>
main ()
{
FILE * pFile;
pFile = tmpfile ();
// temporary file created. code here.
fclose (pFile);
return 0;
}
This code creates a temporary file and then deletes it closing the stream.