diff --git a/src/tox_client.cpp b/src/tox_client.cpp index 3dc9cfe..e602e34 100644 --- a/src/tox_client.cpp +++ b/src/tox_client.cpp @@ -227,6 +227,8 @@ void ToxClient::saveToxProfile(void) { try { std::ofstream ofile{tmp_path, std::ios::binary}; ofile.write(reinterpret_cast(data.data()), data.size()); + ofile.flush(); + if (!ofile.good()) { // TODO: maybe enable fstream exceptions instead? throw std::runtime_error("write error");