classes reflects this difference, i.e. wxFileInputStream will report
wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
+Related to EOF behavior, note that \helpref{SeekI()}{wxinputstreamseeki}
+can seek beyond the end of the stream (file) and will thus not return
+{\it wxInvalidOffset} for that.
\wxheading{Derived from}
classes reflects this difference, i.e. wxFileInputStream will report
wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
+Related to EOF behavior, note that \helpref{SeekO()}{wxoutputstreamseeko}
+can seek beyond the end of the stream (file) and will thus not return
+{\it wxInvalidOffset} for that.
\wxheading{Derived from}
classes reflects this difference, i.e. wxFileInputStream will report
wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
+Related to EOF behavior, note that \helpref{SeekI()}{wxinputstreamseeki}
+can seek beyond the end of the stream (file) and will thus not return
+{\it wxInvalidOffset} for that.
\wxheading{Derived from}
classes reflects this difference, i.e. wxFileInputStream will report
wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
+Related to EOF behavior, note that \helpref{SeekO()}{wxoutputstreamseeko}
+can seek beyond the end of the stream (file) and will thus not return
+{\it wxInvalidOffset} for that.
\wxheading{Derived from}
\func{char}{GetC}{\void}
-Returns the first character in the input queue and removes it.
+Returns the first character in the input queue and removes it,
+blocking until it appears if necessary.
+
+\wxheading{Note}
+
+If EOF, return value is undefined and LastRead() will return 0 and not 1.
\membersection{wxInputStream::Eof}\label{wxinputstreameof}
Returns true if the end of stream has been reached.
+\wxheading{Note}
+
+This cannot be really implemented for all streams and CanRead() is more
+reliable than Eof().
+
\membersection{wxInputStream::LastRead}\label{wxinputstreamlastread}
\constfunc{size\_t}{LastRead}{\void}
Returns the first character in the input queue without removing it.
+\wxheading{Note}
+
+Blocks until something appears in the stream if necessary, if nothing
+ever does (i.e. EOF) LastRead() will return 0 (and the return value is
+undefined), otherwise LastRead() returns 1.
+
\membersection{wxInputStream::Read}
\func{wxInputStream\&}{Read}{\param{void *}{buffer}, \param{size\_t}{ size}}
Changes the stream current position.
+\wxheading{Parameters}
+
+\docparam{pos}{Offset to seek to.}
+
+\docparam{mode}{One of {\bf wxFromStart}, {\bf wxFromEnd}, {\bf wxFromCurrent}.}
+
+\wxheading{Return value}
+
+The new stream position or wxInvalidOffset on error.
+
\membersection{wxInputStream::TellI}
\constfunc{off\_t}{TellI}{\void}
\membersection{wxOutputStream::SeekO}\label{wxoutputstreamseeko}
-\func{off\_t}{SeekO}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode}}
+\func{off\_t}{SeekO}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode = wxFromStart}}
Changes the stream current position.
+\wxheading{Parameters}
+
+\docparam{pos}{Offset to seek to.}
+
+\docparam{mode}{One of {\bf wxFromStart}, {\bf wxFromEnd}, {\bf wxFromCurrent}.}
+
+\wxheading{Return value}
+
+The new stream position or wxInvalidOffset on error.
+
\membersection{wxOutputStream::TellO}
\constfunc{off\_t}{TellO}{\void}
off_t wxFFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
{
- return ( m_file->Seek(pos, mode) ? pos : wxInvalidOffset );
+ return ( m_file->Seek(pos, mode) ? m_file->Tell() : wxInvalidOffset );
}
off_t wxFFileInputStream::OnSysTell() const
off_t wxFFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
{
- return ( m_file->Seek(pos, mode) ? pos : wxInvalidOffset );
+ return ( m_file->Seek(pos, mode) ? m_file->Tell() : wxInvalidOffset );
}
void wxFFileOutputStream::Sync()