Between the time a file name is created and the file is opened, another process can create a file with the same name. Name duplication is unlikely if the other process uses these subroutines or the mktemp subroutine, and if the file names are chosen to avoid duplication by other means. If the String parameter has a null value, the tmpnam subroutine places its result into an internal static area and returns a pointer to that area. The next call to this subroutine destroys the contents of the area. If the String parameter's value is not null, the tmpnam subroutine places its results into the specified array and returns the value of the String parameter.
Directory Points to the path name of the directory in which the file is to be created.
The tempnam subroutine controls the choice of a directory. FileXPointer A pointer to an initial character sequence with which the file name begins. The FileXPointer parameter value can be a null pointer, or it can point to a string of characters to be used as the first characters of the temporary-file name. The number of characters allowed is file system dependent, but 5 bytes is the maximum allowed. Upon completion, the tempnam subroutine allocates space for the string using the malloc subroutine, puts the generated path name in that space, and returns a pointer to the space.