# wxTempFileOutputStream Class Reference
[Streams]

`#include </home/work/projects/wx/2.9/wx/interface/wx/wfstream.h>`

Inheritance diagram for wxTempFileOutputStream:
[legend]

## Detailed Description

wxTempFileOutputStream is an output stream based on wxTempFile.

It provides a relatively safe way to replace the contents of the existing file.

##

Library: wxBase
Category: Streams

See also:
  wxTempFile

## Public Member Functions

| wxTempFileOutputStream (const wxString &fileName)
| Associates wxTempFileOutputStream with the file to be replaced and opens it.
virtual bool | Commit ()
| Validate changes: deletes the old file of the given name and renames the new file to the old name.
virtual void | Discard ()
| Discard changes: the old file contents are not changed, the temporary file is deleted.

List of all members.

## Constructor & Destructor Documentation

wxTempFileOutputStream::wxTempFileOutputStream | ( | const wxString & | fileName | ) |

Associates wxTempFileOutputStream with the file to be replaced and opens it.

Warning:
  You should use wxStreamBase::IsOk() to verify if the constructor succeeded.

Call Commit() or wxOutputStream::Close() to replace the old file and close this one. Calling Discard() (or allowing the destructor to do it) will discard the changes.

## Member Function Documentation

virtual bool wxTempFileOutputStream::Commit | ( |  | ) | `[virtual]`

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.

virtual void wxTempFileOutputStream::Discard | ( |  | ) | `[virtual]`

Discard changes: the old file contents are not changed, the temporary file is deleted.

|  | [ top ]