C Language: tmpfile function(Create Temporary File)

In the C Programming Language, the tmpfile function creates a temporary file. This temporary file will automatically be deleted if either the temporary file is closed or the program ends.


The syntax for the tmpfile function in the C Language is:

FILE *tmpfile(void);


The tmpfile function returns a pointer to the temporary file. If a temporary file can not be created, the tmpfile function returns a null pointer.

Required Header

In the C Language, the required header for the tmpfile function is:

#include <stdio.h>

Applies To

In the C Language, the tmpfile function can be used in the following versions:

  • ANSI/ISO 9899-1990

stdio.h Functions