Important This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 21.3 for BMC Helix Operations Management.

tmpnam()


Return a unique name for temporary file creation.

Syntax

tmpnam()

Parameter

This function does not have any input parameters.

Description

The tmpnam() function returns a name that is guaranteed to be unique and can be used to pass to the fopen function for creating temporary files. 

The semantics of the tmpnam() function are similar to that of the C tmpnam() routine--notably, a restricted number of unique names are returned by the tmpnam() routine as defined by the C constant TMP_MAX. All PSL processes on a given PATROL Agent share the same set of names, and there can be a danger of mixing names. ANSI C guarantees that TMP_MAX is at least 25, but it is typically much larger than that. If the size of TMP_MAX is a concern, add a suffix to the returned file name.

Example

The following example shows how to use the tmpnam() function to generate a temporary file name. The PSL function adds a suffix to the returned name to further guarantee its uniqueness.

name = tmpnam() . ".dave";
printf("The generated name is: %s \n",name);
fp = fopen(name, "w");

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*