Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing to user documents folder C++

I'm trying to write some info to the user's documents folder (eg. C:\Documents and Settings\[userName]), but I can't seem to find out how to grab the path programmatically. Is there any way to do this? C++, not using .NET.

Thanks!

like image 279
user131091 Avatar asked Aug 12 '09 20:08

user131091


1 Answers

SHGetFolderPath with CSIDL_PERSONAL can be used to get the user's Documents folder.

WCHAR path[MAX_PATH];
HRESULT hr = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL,
                             SHGFP_TYPE_CURRENT, path);
like image 106
Michael Avatar answered Sep 21 '22 07:09

Michael