This operation in general is possible only for seekable streams (see wxStreamBase::IsSeekable()); non-seekable streams support only seeking positive amounts in mode wxFromCurrent (this is implemented by reading data and simply discarding it).

Returns the current stream position or wxInvalidOffset if it's not available (e.g.

socket streams do not have a size nor a current stream position).

size_t wxInputStream::Ungetch

(

const void *

buffer,

size_t

size

)

This function is only useful in read mode.

It is the manager of the "Write-Back" buffer. This buffer acts like a temporary buffer where data which has to be read during the next read IO call are put. This is useful when you get a big block of data which you didn't want to read: you can replace them at the top of the input queue by this way.

Be very careful about this call in connection with calling SeekI() on the same stream. Any call to SeekI() will invalidate any previous call to this method (otherwise you could SeekI() to one position, "unread" a few bytes there, SeekI() to another position and data would be either lost or corrupted).

Returns

Returns the amount of bytes saved in the Write-Back buffer.

bool wxInputStream::Ungetch

(

char

c

)

This function acts like the previous one except that it takes only one character: it is sometimes shorter to use than the generic function.