1
ときofstreamのこの実装は動作します動作しません。 ):ofstreamのは、変数が属性
bool LinuxSysCall::addNewUser(std::string const &login, std::string const &password) {
this->out.open(DATABASEPATH, std::ios::app);
if (this->out.is_open())
{
std::string str = login + ":" + password + "\n";
std::cout << "writing " << str << std::endl;
this->out << str;
return true;
}
return false;
}
//The new line is not written in the file
なぜですか?
ストリームを「オープン」(...)と呼ぶ前にストリームが「出ていた」状態は何ですか? –
おそらくthis-> out.is_open()はfalseを返しました。 – Joshua
不要なときは 'this->'を使わないでください。それは騒々しいし、それはCプログラマのように見えるようになります。 –