I cannot hand over my fstream to a function I had created to write text into a textfile.
The fstreams I want to use (for now i only want to use usernameFile):
fstream passwordFile;
fstream usernameFile;
fstream nameFile;
the function where I want to use the "fstream":
void writer(fstream fileToWrite, string stringToWrite, string fileName)
{
fileToWrite.open(fileName, ios::app);
if(fileToWrite.is_open())
{
fileToWrite << stringToWrite << endl;
}
}
The function from where i call the "writer"-function to where i need to hand over the "usernameFile" fstream
void actionLogin() //loginprocedure
{
string username;
string password;
cout << "Type in your Username" << endl;
cin >> username;
system("cls");
cout << "Type in your Password" << endl;
cin >> password;
system("cls");
cout << "Starting verification" << endl;
reader(usernameFile, username, "UsernameSaveFile");
}
Hope anyone can halp me :)