How can I get the path to the current User\'s home directory?
Ex: In Windows, if the current user is \"guest\" I need \"C:\\Users\\guest\"
My application wil
Use the function SHGetFolderPath. This function is preferred over querying environment variables since the latter can be modified to point to a wrong location. The documentation contains an example, which I repeat here (slightly adjusted):
#include // need to include definitions of constants
// .....
WCHAR path[MAX_PATH];
if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, path))) {
...
}