GetTempPath

  DWORD GetTempPath(cchBuffer, lpszTempPath)    
  DWORD cchBuffer; /* size of the buffer in characters */
  LPTSTR lpszTempPath; /* addr of buffer for temp path name */

The GetTempPath function obtains the pathname of the directory that should be used to create temporary files.

Parameters

cchBuffer

Specifies the size in characters of the string buffer pointed to by lpszTempPath.

lpszTempPath

Points to a string buffer that the function will fill with the temporary file pathname.

Return Value

If the function is successful, the return value is the length of the string copied to lpszTempPath (in characters), not including the terminating null character. If the return value is greater than cchBuffer, the return value is the size of the buffer required to hold the pathname.

If the function fails, the return value is zero. Use the GetLastError function to obtain extended error information.

Comments

The GetTempPath function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

GetTempFileName