Skip to content

WindowsApi:GetTempPath

임시 디렉터리명 획득.

Syntax

DWORD WINAPI GetTempPath(
  _In_  DWORD  nBufferLength,
  _Out_ LPTSTR lpBuffer
);

Return value

If the function succeeds, the return value is the length, in TCHARs, of the string copied to lpBuffer, not including the terminating null character. If the return value is greater than nBufferLength, the return value is the length, in TCHARs, of the buffer required to hold the path.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

The maximum possible return value is MAX_PATH+1 (261).

Remarks

The GetTempPath function checks for the existence of environment variables in the following order and uses the first path found:

  1. The path specified by the TMP environment variable.
  2. The path specified by the TEMP environment variable.
  3. The path specified by the USERPROFILE environment variable.
  4. The Windows directory.

See also

Favorite site