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 - create temporary file

&pagelevel(4)&pagelevel

Syntax

#include <stdio.h>

FILE *tmpfile(void); 

Description

tmpfile() creates a temporary file and opens an associated data stream.
BS2000
tmpfile() creates a binary SAM file with default attributes. (End)

The file is automatically deleted when all links to the file are closed. The file is opened as in fopen() for update (w+).

The directory in which the temporary file will be created, {P_tmpdir}, is defined in stdio.h as /var/tmp.

Return val.

Pointer to the stream for the created file



if successful.


Null pointer

if an error occurs. errno is set to indicate the error.

Errors

tmpfile() will fail if:

 

EINTR

A signal was caught when executing the tmpfile() function.

 

EMFILE

{OPEN_MAX} streams are currently open in the calling process.
{FOPEN_MAX} streams are currently open in the calling process.

 

ENFILE

The maximum number of files allowed is currently open in the system.

 

ENOSPC

The directory or file system which would contain the new file cannot be expanded.

Notes

The program environment determines whether tmpfile() is executed for a BS2000 or POSIX file.

Temporary files are not deleted when a program terminates abnormally with abort() or _exit(-1).

See also

fopen(), tmpnam(), unlink(), stdio.h.