Topic: c++ iostream behavior


Author: tiago_rodrigues@oninetspeed.pt (Tiago Rodrigues)
Date: Tue, 27 May 2003 17:20:57 +0000 (UTC)
Raw View
Hi,

 I implemented a streambuffer that derives from std::streambuf,
implementing the overflow(),underflow(),sync(),xsputn() and xsgetn()
methods. I also derived a new Stream class from std::iostream and used
the previous implemented streambuffer with it. The main objective of
implementing these classes was to connect a stream to a socket.
 While testing the class in some esporadic and rare cases the stream
becomes bad() and fail(). I would like to know what causes a stream to
go "bad" since nothing in the stream buffer sets that derectly. The only
thing that the string buffer signals is the EOF when there is no data to
read from the socket and i presume standart iostream   sets the eof bit
not the bad and fail bit in that case. What i would like to know is in
what situations can an iostream become bad, and what can i do to control
it, since the only thing i implement is the streambuffer it self.

thanks in advance,
Omicron.



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]