INtime SDK Help
GetRtTempFileName

Creates a name for a temporary file. If a unique file name is generated, an empty file is created; otherwise, only a file name is generated.

DWORD GetRtTempPath(
        LPCSTR lpPathName,
        LPCSTR lpPrefixString,
        UINT uUnique,
        LPSTR lpTempFileName
);

Parameters

lpPathName [in]
The directory path for the file name. Applications typically specify a period (.) for the current directory or the result of the GetRtTempPath function. The string cannot be longer than MAX_PATH–14 characters or GetRtTempFileName will fail. If this parameter is NULL, the function fails.
lpPrefixString [in]
The null-terminated prefix string. The function uses up to the first four characters of this string as the prefix of the file name.
uUnique
An unsigned integer to be used in creating the temporary file name. If this is zero then a value is created by using the current system time. If a file already exists with the generated name, this value is incremented and the function tests again. This continues until a unique name is found. Note that the function does not attempt to verify the uniqueness of the name if this value is non-zero.
lpTempFileName
A pointer to the buffer that receives the temporary file name. This buffer should be MAX_PATH characters to accommodate the path plus the terminating null character.

Comments

The call looks for the environment variable "TMP" and returns its value. If that value is not present it next tries the variable "TEMP".

Return Values

If the function succeeds, the return value specifies the unique numeric value used in the temporary file name. If the uUnique parameter is nonzero, the return value specifies that same number. If the function fails, the return value is zero. To get extended error information, call GetLastRtError.

Possible extended return values include:

Value Description
E_PARAM One or both of lpPathName or lpPrefixString was NULL.
E_LIMIT The length of the string pointed to by the lpPathName parameter is more than MAX_PATH–16 characters.

Requirements

Versions Defined in Include Link to
INtime 5.2 intime/rt/include/rtbase.h rt.h rt.lib