jeudi 26 février 2015

C++ Why in one case saving to file is working and another not?


Need some help over here, can somone explain me why this is working :



void change_boss()
{
string password;
fstream file;



cout << "Type new password" << endl;
cin >> password;
file.open("admin_list.txt");
file << password;
file.close();

};


and this is not working ?



void change_worker()
{
string pass;
fstream file;


cout << "Type new password" << endl;
cin >> pass;
file.open("worker_list.txt");
file >> pass;
file.close();

};


Any idea ? Coz I have no idea whats wrong with that




Aucun commentaire:

Enregistrer un commentaire