wxTempFileOutputStream is an output stream based on wxTempFile. It provides a relatively safe way to replace the contents of the existing file.
wxTempFileOutputStream(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.
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.
Discard changes: the old file contents are not changed, the temporary file is deleted.