Function tmpfile () in C
Function FILE * tmpfile (void) in standard C Library Create temporary files in wb + mode. The temporary file created will be automatically deleted when the stream is closed (fclose function) or when the program ends.
Declare the function tmpfile () in C
Below is the declaration for the function tmpfile () in C:
FILE * tmpfile ( void )
Parameters
This function does not receive any parameters.
Returns the value
If successful, this function returns a pointer to the temporary file created. If this file cannot be created, then the function returns NULL.
For example
The following program C illustrates the usage of the function tmpfile () in C:
#include int main () { FILE * fp ; fp = tmpfile (); printf ( "Mot file tam thoi duoc tao !!!n" ); /* truoc khi su dung fclose, ban co the su dung file tam thoi nay */ fclose ( fp ); return ( 0 ); }
Compile and run the above program to create a temporary file in / tmp folder but when the program exits, it will automatically be deleted and the program will produce the following result:
According to Tutorialspoint
Previous lesson: Function setvbuf () in C
Next lesson: Function tmpnam () in C
You should read it
Maybe you are interested
Instructions for using the TRIMRANGE function to clean up Excel tables
How to master numerical data in Google Sheets with the AVERAGE function
Don't buy headphones if they lack this important function!
sorted() function in Python
Common connection ports found on computers and their functions
How to automatically display names when entering code in Excel - Combine IF function and Vlookup function