|
|
Tutorials

Cpp

|
Topic |
How is "tmpfile()" used in C++?
|
|
Explanation |
|
tmpfile() is an I/O function which is used to open temporary file for update which will be deleted when the
stream closes. If the temporary file is created the function returns a stream pointer, otherwise NULL
is returned.
Syntax:
FILE * tmpfile ( void );
Example:
#include <stdio.h>
int main ()
{
FILE * str = tmpfile ();
fclose (str);
return 0;
}
|
In the above example the opened temporary file will get closed when the stream "str" is closed.
|
| Note |
C++ is one of the most used programming languages in the world. Also known as "C with Classes".
Hope you enjoy this tutorial. Do send your feedback or suggestions on this C++ tutorial. This is a copyright content.
|
|
|
|