TMPNAM - create name for temporary file.

(ANSI Standard)


#include <stdio.h>
name = tmpnam(s);


char *s;
is either a null pointer or a pointer to a character array. This array must be able to hold at least "L_tmpnam" characters (where "L_tmpnam" is a constant #defined in <stdio.h>).
char *name;
points to the chosen name for the temporary file. This name will be stored in the area pointed to by "s" if "s" was not NULL. If "s" was NULL, the name will be placed in static storage. Subsequent calls to "tmpnam" will overwrite previous names. If "tmpnam" cannot create an appropriate name, it returns NULL.


"tmpnam" generates a name for a temporary file using the path prefix defined as "P_tmpdir" in <stdio.h>. Only the name is created: the file is not created or opened. Each call to "tmpnam" creates a new name (and may overwrite the previous one if "s" is NULL).

In this version of C, names created by "tmpnam" will have the form "fc*NN", where NN is a pair of digits. If the program actually opens a file with this name, it will be a GCOS-8 temporary file; in batch, it will have the file code NN.

See Also:

expl nsc lib mktemp

expl nsc lib tmpfile

Copyright © 2000, Thinkage Ltd.