Open System Services Library Calls Reference Manual (G06.28+, H06.05+)

tempnam 3() OSS Library Calls Reference Manual
NAME
tempnam - Constructs the name for an OSS temporary le
LIBRARY
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <stdio.h>
char *tempnam(
const char *directory,
const char *prex);
PARAMETERS
directory Points to the pathname of the directory in which the le is to be created.
prefix Points to an initial character sequence with which the lename begins. The
prex parameter can be null, or it can point to a string of up to ve characters to
be used as the rst characters of the temporary lename.
DESCRIPTION
The tempnam() function generates lenames for temporary OSS les.
The tempnam() function allows you to control the choice of a directory. If the directory parame-
ter is null or points to a string that is not a pathname for an appropriate directory, the pathname
dened as P_tmpdir in the stdio.h header le is used. If that pathname is not accessible, /tmp is
used. You can bypass the selection of a pathname by providing an environment variable,
TMPDIR, in the users environment. The value of the TMPDIR variable is a pathname for the
desired temporary le directory.
The prex parameter can be used to specify a prexofuptove characters for the temporary
lename.
RETURN VALUES
Upon successful completion, the tempnam() function returns a pointer to the generated path-
name, suitable for use in a subsequent call to the free() function. Otherwise, null is returned and
errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the tempnam() function sets errno to the correspond-
ing value:
[ENOMEM] Sufcient storage space is not available.
RELATED INFORMATION
Functions: fopen(3), free(3), malloc(3), open(2), tmple(3), tmpnam(3), unlink(2).
724 Hewlett-Packard Company 527187-007