如何获得在C%AppData的%文件夹?

问题描述:

如上,如何用C我得到AppData文件夹在Windows?

As above, how do I get the AppData folder in Windows using C?

我知道,C#使用 Environment.SpecialFolder.ApplicationData ​​ code>

使用 SHGetSpecialFolderPath CSIDL设定所需的文件夹(大概CSIDL_APPDATA或CSIDL_LOCAL_APPDATA)。

Use SHGetSpecialFolderPath with a CSIDL set to the desired folder (probably CSIDL_APPDATA or CSIDL_LOCAL_APPDATA).

您也可以使用新的的SHGetFolderPath()和 SHGetKnownFolderPath()的功能。
还有 SHGetKnownFolderIDList(),如果​​你喜欢COM有IKnownFolder::GetPath().

You can also use the newer SHGetFolderPath() and SHGetKnownFolderPath() functions. There's also SHGetKnownFolderIDList() and if you like COM there's IKnownFolder::GetPath().