winapi - Best way of getting path to "Application Data" directory? -


There are several possible methods of obtaining the path to the application data directory:

  • % APIDATA% Environment variable
  • SHGetFolderPath with CSIDL_APPDATA

Call a program What is the best way to find a path from within?

Itemprop = "text">

I suggest calling SHGetFolderPath () is the most appropriate and portable method; The option, such as reading the environmental variable, or (bad) is trying to remove it from the registry, in the future you are likely to travel.

Explaining why the authorities are pulling such paths from the registry is a bad idea.


Comments