Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

tmpfile, tmpfile64 - Open temporary binary file

&pagelevel(4)&pagelevel

Definition  

#include <stdio.h>

FILE *tmpfile(void);
FILE *tmpfile64(void);

tmpfile and tmpfile64 generate a unique file name (in an analogous manner to the tmpnam function) and open a binary SAM file with default attributes under this name. The file is opened in the wb+ mode (write and read).

The file is automatically removed when the program terminates normally or when the file is closed.

There is no functional difference between tmpfile and tmpfile64, except that tmpfile64 returns a file pointer to a temporary file that can be > 2 GB.

To process files > 2 GB, proceed as follows:

  • If the _FILE_OFFSET_BITS 64 define (see "Support for DMS and UFS files > 2 GB") is set, call tmpfile. tmpfile64 is then used implicitly with the appropriate parameters.

  • Otherwise, you have to call tmpfile64.

Return val.

Pointer to the assigned FILE structure


if successful.

NULL pointer

if the file could not be opened.

Note

If the program is terminated abnormally with abort or _exit(-1), the temporary files are not deleted.

See also

tmpnam, mktemp, abort