#include <iostream>
#include <string>
#include <fstream>
//---
using namespace std;
//---
int main()
{
string myFile = "theName.txt";
std::string combined = "echo %USERPROFILE% >> C:\\Windows\\Temp\\"+ myFile ;
system(combined.c_str());
fstream dog;
std::string combined2 = "C:\\Windows\\Temp\\" + myFile;
dog.open(combined2.c_str());
char data[100];
dog >> data;
cout << data;
int cat = 0;
cin >> cat;
return 0;
}
//--
//---
//------------------------------------------------------------------------------------
Could be better... although in terms of simplicity so far the best way of looking at it... I have gone over a few answer to the problem online and what I've learned is pretty simple... Coding without the namespace std; I obviously just learned that.
Looking at what edits I should get on... I see... That not only should I remove the file, but that I also should retrive the explicit user name from the string...