You cannot add two arrays of characters together and get meaningful results. These are pointers, not a class like std :: string, which provides such useful operations.
Create a large enough TCHAR array and use GetTempPath, then use strcat to add the file name to it.
TCHAR temp_file [265]; GetTempPath(255, temp_file); strcat(temp_file, "temp1.txt");
Ideally, you should also check the GetTempPath result for failure. As far as I can see from the documentation associated with the other answer, the most likely cause of the failure is that the specified path variable is too small. Use MAX_PATH + 1 + 9 as recommended there.
source share