Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application Data Folder

Status
Not open for further replies.

CosminU

Programmer
Joined
Jun 11, 2005
Messages
2
Location
RO
Hello,

How can I find the path to the "application data" folder for the current user and for "all users". I need a function or algorithm that will run properly under WinXP, 2000, Me and 98
Thanks.

Regards,
Cosmin
 
Try something like this:
Code:
DWORD size = 0;
vector<char> buf( MAX_PATH );
string appData;
size = ExpandEnvironmentStrings( "%APPDATA%", buf[0], buf.size() );

if ( size <= buf.capacity() )
{
   appData.assign( buf[0], size - 1 );
}
else if ( size > buf.capacity() )
{
   // buf isn't big enough.
}
else
{
   // An error happened.
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top