wxtempfileoutputstreamwxtempfileoutputstream is an output stream based on wxtempfile. it provides a relatively safe way to replace the contents of the existing file. derived from include files <wx/wfstream.h> see also members
wxtempfileoutputstream::wxtempfileoutputstream
wxtempfileoutputstream::wxtempfileoutputstreamwxtempfileoutputstream(const wxstring& filename) associates wxtempfileoutputstream with the file to be replaced and opens it. you should use isok to verify if the constructor succeeded. call commit() or close() to replace the old file and close this one. calling discard() (or allowing the destructor to do it) will discard the changes.
wxtempfileoutputstream::commitbool commit() validate changes: deletes the old file of the given name and renames the new file to the old name. returns true if both actions succeeded. if false is returned it may unfortunately mean two quite different things: either that either the old file couldn't be deleted or that the new file couldn't be renamed to the old name.
wxtempfileoutputstream::discardvoid discard() discard changes: the old file contents are not changed, the temporary file is deleted.
|