2.1.10.31 GetTempPath


Description

The GetTempPath function retrieves the path of the directory designated for temporary files.

Syntax

DWORD GetTempPath( DWORD nBufferLength, LPSTR lpBuffer )

Parameters

nBufferLength
[input]Specifies the size, in TCHARs, of the string buffer identified by lpBuffer.
lpBuffer
[output]Pointer to a string buffer that receives the null-terminated string specifying
the temporary file path. The returned string ends with a backslash, for example, C:\TEMP\.

Return

If the function succeeds, the return value is the length, not including the terminating null character.

If the return value is greater than nBufferLength, the return value is the size of the buffer required to hold the path.

If the function fails, the return value is zero.

Examples

EX1

int GetTempPath_ex1()
{
    char        sztemp[MAXFULLPATH];
    DWORD        aa = GetTempPath(MAXFULLPATH, sztemp);
    out_str(sztemp);
    return 1;
}

Remark

See Also

GetTempFileName

Header to Include

origin.h

Reference