Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)
tmpfile_guardian(3) Guardian Native C Library Calls Reference Manual
NAME
tmpfile_guardian - Creates a temporary file (Guardian tmpfile( ) function)
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <stdio.h>
FILE *tmpfile(void);
FILE *tmpfile_guardian(void);
DESCRIPTION
The tmpfile() Guardian function and tmpfile_guardian() function create a temporary file and
return its FILE pointer. The file is opened for update. The temporary file is automatically deleted
when the process using it terminates.
The temporary file is a type 180 C binary file, opened for ANSI I/O, and with binary update
access ("wb+").
These functions are identical in the Guardian environment. Unless otherwise noted, this refer-
ence page uses tmpfile() to refer to both the tmpfile() Guardian function and
tmpfile_guardian() function.
Interoperability Variants
The C run-time library supports two variants of the tmpfile() function: tmpfile_oss( ) and
tmpfile_guardian(). The variants support the unique file-naming conventions and structures of
the OSS and Guardian file systems, respectively.
For the TNS C runtime library only, the header file maps calls to tmpfile() to the variant that
matches the target compilation environment. The target environment is set with the systype
pragma.
Explicit calls to the tmpfile_oss() and tmpfile_guardian() variants in source code are only
made when the behavior of one environment is desired from the other environment.
tmpfile_oss() is functionally identical to the tmpfile() function of the OSS environment. It is the
same as setting systype oss at compile time. systype oss is the default setting for c89 in
the OSS environment.
tmpfile_guardian() is functionally identical to the tmpfile() function of the Guardian environ-
ment. It is the same as setting systype guardian at compile time. systype guardian is
the default setting for the C and C++ compilers in the Guardian environment.
To use the tmpfile_oss() or tmpfile_guardian() functions, specify the _TANDEM_SOURCE
feature test macro.
RETURN VALUES
Upon successful completion, the tmpfile() function returns a pointer to the stream of the file that
is created. Otherwise, it returns a null pointer, and sets errno to indicate the error.
ERRORS
If any of these conditions occurs, the tmpfile() function sets errno to the corresponding value:
[EMFILE] The OPEN_MAX file descriptors are currently open in the calling process.
7−18 Hewlett-Packard Company 527192-007