Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
tempnam(3) Guardian Native C Library Calls Reference Manual
NAME
tempnam - Constructs the name for an OSS temporary file
LIBRARY
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdio.h>
char *tempnam(
const char *directory,
const char *prefix);
PARAMETERS
directory Points to the pathname of the directory in which the file is to be created.
prefix Points to an initial character sequence with which the filename begins. The
prefix parameter can be null, or it can point to a string of up to five characters to
be used as the first characters of the temporary filename.
DESCRIPTION
The tempnam( ) function generates filenames for temporary OSS files.
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
defined as P_tmpdir in the stdio.h header file 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 user’s environment. The value of the TMPDIR variable is a pathname for the
desired temporary file directory.
The prefix parameter can be used to specify a prefix of up to five characters for the temporary
filename.
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] Sufficient storage space is not available.
RELATED INFORMATION
Functions: fopen(3), free(3), malloc(3), open(2), tmpfile(3), tmpnam(3), unlink(2).
7−10 Hewlett-Packard Company 527192-018