Here is how you do it...
Code:#include <iostream> #include <windows.h> #include <conio.h> using namespace std; int main() { char profilepath[250]; ExpandEnvironmentStrings("%userprofile%",profilepath,250); cout << profilepath; getch(); return 0; }