Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Standard C++ Streams Question!

0 views
Skip to first unread message

Sunil

unread,
Aug 23, 2001, 1:22:28 PM8/23/01
to
All,

I have a question regarding equivalent behaviour between classic and
standard
C++ streams as supported by the Sun Forte compiler - Specifically what
would
be the equivalent of the obsoleted "out_waiting()" method from the
"streambuf"
class of classic streams ??
So if the code was :
if (out_waiting()) // Using Classic C++ streams,
....
what would be the equivalent in Standard Streams ??

Thanks,
Sunil.


John Harrison

unread,
Aug 23, 2001, 1:15:48 PM8/23/01
to

"Sunil" <sat...@ppllc.com> wrote in message
news:3B853BD4...@ppllc.com...

Perhaps if you told us what out_waiting did then someone would be able
to say.

If this is some sort of routine for non-blocking input then
unfortunately there is no equivalent in standard iostreams.

john

Sunil

unread,
Aug 24, 2001, 8:33:41 PM8/24/01
to
All,

I have a question regarding equivalent behaviour between classic and
standard
C++ streams as supported by the Sun Forte compiler - Specifically what
would
be the equivalent of the obsoleted "out_waiting()" method from the
"streambuf"
class of classic streams ??
So if the code was :
if (out_waiting()) // Using Classic C++ streams,
....
what would be the equivalent in Standard Streams ??

Thanks,
Sunil.


[ Send an empty e-mail to c++-...@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]

Dietmar Kuehl

unread,
Aug 24, 2001, 9:14:30 PM8/24/01
to
Hi,

Sunil wrote:
> Specifically what would
> be the equivalent of the obsoleted "out_waiting()" method from the
> "streambuf" class of classic streams ??

I would guess that 'out_waiting()' told whether there are characters
currently buffered by the stream buffer (it is basically impossible
to tell because prior to the first C++ standard there was, well, no
standard describing all systems). There is no such function in the
standard C++ library, basically because this issue is supposed to be
transparent.

My guess is that you don't really need this function but you should
rather just flush the stream. If you really need this information
and you are not implementing a stream buffer, you might get away by
implementing a filtering stream buffer which provides this additional
member and does some buffering. Whenever the filtering stream buffer
writes its buffer to the underlying stream buffer, it also flush the
underlying stream buffer by calling pubsync().

If you are implementing a stream buffer (this looks likely due to
the notation in your statement) you can easily implement this
functionality:

std::streamsize out_waiting() const { return pptr() - pbase(); }
--
<mailto:dietma...@yahoo.com> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>

0 new messages