sync() after write to avoid losing file data on power off.

This commit is contained in:
Robin Davies
2024-09-01 09:53:32 -04:00
parent abb8a1a53c
commit b8c4fafd3a
21 changed files with 102 additions and 34 deletions
+19
View File
@@ -0,0 +1,19 @@
#include "ofstream_synced.hpp"
#include "unistd.h"
using namespace pipedal;
void pipedal::FileSystemSync()
{
::sync();
}
ofstream_synced::~ofstream_synced()
{
if (is_open())
{
close();
::sync();
}
}