tmpfile function(Create Temporary File) in C Language – example and detail

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


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

FILE *tmpfile(void);


The tmpfile feature returns a pointer to the temporary file. If a brief file can now not be created, the tmpfile characteristic returns a null pointer.

Required Header

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

#include <stdio.h>

Applies To

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

ANSI/ISO 9899-1990

See Also

Other C functions that are noteworthy when dealing with the tmpfile function:

tmpnam function fopen function