HP 3000 Manuals

tmpnam [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Library Reference Manual

tmpnam 

Creates a name for a temporary file.

Syntax 

     #include <stdio.h>
     char *tmpnam (char *s);

Parameters 

s             Either NULL or a pointer to an array of at least L_tmpnam
              bytes, where L_tmpnam is a constant defined in <stdio.h>.

Return Values 

x             If s is NULL, a pointer to a static buffer which contains a
              file name.  If s is not NULL, the value of the argument s.

Description 

The tmpnam function generates a file name that can safely be used as a
temporary file.  This function generates a different file name each time
it is called.

If s is null, tmpnam() leaves its result in an internal static area and
returns a pointer to that area.  The next call to tmpnam() destroys the
contents of the area.  If s is not null, it is assumed to be the address
of an array of at least L_tmpnam bytes, where L_tmpnam is a constant
defined in <stdio.h>; tmpnam places its result in that array and returns
s.

A file created using tmpnam() and fopen() is temporary only in the sense
that it is intended for temporary use.  It is your responsibility to
remove the file when it is no longer needed.

Between the time a file name is created and the file is opened, it is
possible for some other process to create a file with the same name.
This is extremely unlikely if the other process is using this function or
mktemp() because these functions choose file names in a way that
minimizes duplication.

See Also 

tmpfile(), ANSI C 4.9.4.4, POSIX.1 8.1



MPE/iX 5.0 Documentation