[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


tmpfile Subroutine

Purpose

Creates a temporary file.

Library

Standard C Library (libc.a)

Syntax

#include <stdio.h>

FILE *tmpfile ( )

Description

The tmpfile subroutine creates a temporary file and opens a corresponding stream. The file is opened for update. The temporary file is automatically deleted when all references (links) to the file have been closed.

The stream refers to a file which has been unlinked. If the process ends in the period between file creation and unlinking, a permanent file may remain.

Return Values

The tmpfile subroutine returns a pointer to the stream of the file that is created if the call is successful. Otherwise, it returns a null pointer and sets the errno global variable to indicate the error.

Error Codes

The tmpfile subroutine fails if one of the following occurs:

EINTR A signal was caught during the tmpfile subroutine.
EMFILE The number of file descriptors currently open in the calling process is already equal to OPEN_MAX.
ENFILE The maximum allowable number of files is currently open in the system.
ENOSPEC The directory or file system which would contain the new file cannot be expanded.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The fopen, freopen, fdopen subroutines, mktemp subroutine, tmpnam or tempnam (tmpnam or tempnam Subroutine) subroutine, unlink (unlink Subroutine) subroutine.

Files, Directories, and File Systems for Programmers in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]