From: Vadim Zeitlin Date: Sun, 31 May 2009 09:49:31 +0000 (+0000) Subject: added wxTempFile::Flush() (dedicated to Theodore Ts'o and Ext4) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f1a73c6a816aeba155e88c628a0a778a2fe068bd added wxTempFile::Flush() (dedicated to Theodore Ts'o and Ext4) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60830 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 4f525f48a8..345e0c1e1b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -330,6 +330,7 @@ All: - Added wxStd{Input,Output}Stream classes (Jonathan Liu). - Include port number in host header in wxHTTP (Marcin 'Malcom' Malich). +- Added wxTempFile::Flush(). All (GUI): diff --git a/include/wx/file.h b/include/wx/file.h index df901520ef..5f00e49c11 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -197,6 +197,10 @@ public: bool Write(const wxString& str, const wxMBConv& conv = wxMBConvUTF8()) { return m_file.Write(str, conv); } + // flush data: can be called before closing file to ensure that data was + // correctly written out + bool Flush() { return m_file.Flush(); } + // different ways to close the file // validate changes and delete the old file of name m_strName bool Commit(); diff --git a/interface/wx/file.h b/interface/wx/file.h index 30269c2e53..10efe6534d 100644 --- a/interface/wx/file.h +++ b/interface/wx/file.h @@ -129,6 +129,18 @@ public: */ void Discard(); + /** + Flush the data written to the file to disk. + + This simply calls wxFile::Flush() for the underlying file and may be + necessary with file systems such as XFS and Ext4 under Linux. Calling + this function may however have serious performance implications and + also is not necessary with many other file systems so it is not done by + default -- but you can call it before calling Commit() to absolutely + ensure that the data was indeed written to the disk correctly. + */ + bool Flush(); + /** Returns @true if the file was successfully opened. */