Full prototype:

FILE* tmpfile(void);  

Purpose and Notes:

Creates, opens, and returns a file pointer to a new temporary file in "wb+" mode.

Useful for creating files you do not want long term and just need for small tasks during the execution of your program.

It is implementation defined how "temporary" they really are, but on most unix systems they will open in the /tmp directory which will remove them the next time your computer reboots. Thus you should never rely on these files being there at the start of your program.


FILE*- The file pointer to the newly created temporary file.

Argument 1:

void- Takes in no arguments.

Example 1