Hi folks,
Today we will see how we can get the folder path of the windows user specific app data for storing any program (app) based information.
Source
#include <iostream>
#include <tchar.h>
#include <shlwapi.h>
#pragma comment(lib,"shlwapi.lib")
#include "shlobj.h"
using namespace std;
int main()
{
TCHAR szPath[MAX_PATH];
// Get path for each computer, non-user specific and non-roaming data.
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath)))
{
// Append product-specific path
PathAppend(szPath, _T("\\App Folder Path\\"));
wcout << "User AppData Roaming Folder Path: \n" << szPath << endl << endl;
}
// Get path for each computer, non-user specific and non-roaming data.
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, 0, szPath)))
{
wcout << "System Program Files Folder Path: \n" << szPath << endl << endl;
}
cout << "==end==";
}
Hope this helps you to customize your requirement.
References
https://docs.microsoft.com/en-us/windows/win32/shell/csidl
Please share your comments and feedback to psrdotcom@gmail.com
No comments:
Post a Comment