## wxOutputStream

wxOutputStream is an abstract base class which may not be used directly.

Derived from

wxStreamBase

Include files

<wx/stream.h>

Members

wxOutputStream::wxOutputStream
wxOutputStream::~wxOutputStream
wxOutputStream::Close
wxOutputStream::LastWrite
wxOutputStream::PutC
wxOutputStream::SeekO
wxOutputStream::TellO
wxOutputStream::Write

### wxOutputStream::wxOutputStream

wxOutputStream()

Creates a dummy wxOutputStream object.

### wxOutputStream::~wxOutputStream

~wxOutputStream()

Destructor.

### wxOutputStream::Close

bool Close()

Closes the stream, returning `false` if an error occurs. The stream is closed implicitly in the destructor if Close() is not called explicitly.

If this stream wraps another stream or some other resource such as a file, then the underlying resource is closed too if it is owned by this stream, or left open otherwise.

### wxOutputStream::LastWrite

size_t LastWrite() const

Returns the number of bytes written during the last Write(). It may return 0 even if there is no error on the stream if it is only temporarily impossible to write to it.

### wxOutputStream::PutC

void PutC(char c)

Puts the specified character in the output queue and increments the stream position.

### wxOutputStream::SeekO

off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart)

Changes the stream current position.

Parameters

pos

Offset to seek to.

mode

One of wxFromStart, wxFromEnd, wxFromCurrent.

Return value

The new stream position or wxInvalidOffset on error.

### wxOutputStream::TellO

off_t TellO() const

Returns the current stream position.

### wxOutputStream::Write

wxOutputStream& Write(const void *buffer, size_t size)

Writes up to the specified amount of bytes using the data of buffer. Note that not all data can always be written so you must check the number of bytes really written to the stream using LastWrite() when this function returns. In some cases (for example a write end of a pipe which is currently full) it is even possible that there is no errors and zero bytes have been written.

This function returns a reference on the current object, so the user can test any states of the stream right away.

wxOutputStream& Write(wxInputStream& stream_in)

Reads data from the specified input stream and stores them in the current stream. The data is read until an error is raised by one of the two streams.