How to get the %AppData% folder in C?

后端 未结 5 905
予麋鹿
予麋鹿 2020-12-11 03:45

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

I know that for C# you use Environment.SpecialFolder.ApplicationData

5条回答
  •  忘掉有多难
    2020-12-11 04:11

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

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

提交回复
热议问题