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
Difference between function and formula in Excel
8 little-known Excel functions that can save you a lot of work
How to use the NORMDIST function in Excel - Function that returns the distribution in Excel
Date functions in Excel, DAY, WEEKDAY, MONTH
How to use the SUMIF function in Excel to calculate the sum based on conditions
How to use the Round function in Excel to round numbers and process data