tmpfile

Creates a temporary binary file.

Library:LibC
Classification:ANSI
Service:File and Directory I/O

Syntax

  #include <stdio.h> 
   
  FILE *tmpfile ( void );
  

Return Values

If successful, returns a pointer to the stream of the file that it created. Otherwise, returns a NULL pointer and sets errno to one of the following:

Decimal

Constant

Description

5

ENOMEM

Insufficient storage space is available.

10

ENFILE

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

11

EMFILE

The calling process currently has the maximum number of streams or files open.

12

ENOSPC

The directory or file system, which would contain the new file, has no space.

63

EINTR

A signal interrupted the operation.

81

EOVERFLOW

The size of the file cannot be represented correctly in an object of type off_t.

Remarks

The tmpfile function creates a temporary binary file that is automatically removed when it is closed or at program termination. The file is opened for update.

See Also