2.1.10.34 get_temp_path


Description

Get the temporary path as a string.

Syntax

int get_temp_path( LPSTR lpBuffer, int nBufferSize )

Parameters

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\.
nBufferSize
[input]Specifies the size of the string buffer identified by lpBuffer

Return

0 = return by WinAPI GetTempPath

1 = return TEMP folder in Origin ini path

2 = failure

Examples

EX1

void get_temp_path_ex1()
{
    char szTemp[MAXFULLPATH];
    int nTempPathType = get_temp_path(szTemp, MAXFULLPATH);
    if(0 == nTempPathType)
    {
        printf("Temp path is %s\n which is the standard location and is writable.\n", szTemp);
    }
    else if(1 == nTempPathType)
    {
        printf("For some reason the standard windows temp path is not writable, so we have to use Origin's user files path as the temp path\n%s\n", szTemp);
    }
    else 
        out_str("Error getting a valid temp path");
}

Remark

See Also

Header to Include

origin.h

Reference