How to get the “temp folder” in Windows 7?

2019-06-21 08:43发布

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

3条回答
聊天终结者
2楼-- · 2019-06-21 08:46

You could get the environment variable for the temp folder:

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

查看更多
放荡不羁爱自由
3楼-- · 2019-06-21 08:48

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);
查看更多
我只想做你的唯一
4楼-- · 2019-06-21 09:04

Have you given a try to GetTempPath()?

Retrieves the path of the directory designated for temporary files.

You can find a code sample here.

查看更多
登录 后发表回答