Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the "temp folder" in Windows 7?

In Windows 7, how can I get programatically the system temporary folder?

like image 704
Ullan Avatar asked Feb 02 '12 20:02

Ullan


3 Answers

The GetTempPath function is probably what you're looking for.

TCHAR buf [MAX_PATH];

if (GetTempPath (MAX_PATH, buf) != 0)
    MessageBox (0, buf, _T("Temp path"), 0);
like image 112
James McLaughlin Avatar answered Oct 12 '22 12:10

James McLaughlin


Have you given a try to GetTempPath()?

Retrieves the path of the directory designated for temporary files.

You can find a code sample here.

like image 2
nulltoken Avatar answered Oct 12 '22 13:10

nulltoken


You could get the environment variable for the temp folder:

http://msdn.microsoft.com/en-us/library/ms683188%28VS.85%29.aspx

like image 1
Phil Hannent Avatar answered Oct 12 '22 13:10

Phil Hannent