string currentUser()
{
string user;
ofstream outf("CurrentUser.dat", ios::trunc);
system("whoami >> CurrentUser.dat");
outf.close();
ifstream inf("CurrentUser.dat");
inf >> user;
return user;
}
This is a function that gets the name of the current active user. It creates a data file, with the contents being the username. The problem is, to create a file path that is the same as all of the other files created by this program, the program needs to know what the username is. It cannot do this until this function is called... it becomes a sort of catch 22ish recursive function call situation. I want this data file grouped in the same directory as all of the other data and script files, but how? Thanks in advance