what is the concept behind cout object?

what is the concept behind cout object and also insertion operator ?
that is one hell of a broad question you have there
Google Google Google Google Google
For the first I don't know, buti do know the answer to the second question. Just wait until I get on my laptop (I'm on a cellphone right now)
OK, this is the code for the M_insert function, that all insertion operators use:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  template<typename _CharT, typename _Traits>
    template<typename _ValueT>
      basic_ostream<_CharT, _Traits>&
      basic_ostream<_CharT, _Traits>::
      _M_insert(_ValueT __v)
      {
	sentry __cerb(*this);//the sentry is a class that's used for chacking for I/O errors
	if (__cerb)//every thing is OK
	  {
	    ios_base::iostate __err = ios_base::goodbit;//good untill proved bad
	    try
	      {
		const __num_put_type& __np = __check_facet(this->_M_num_put); //the locale facet's number put
		if (__np.put(*this, *this, this->fill(), __v).failed())//if failed
		  __err |= ios_base::badbit;//it's bad
	      }
	    catch(__cxxabiv1::__forced_unwind&)//dunno
	      {
		this->_M_setstate(ios_base::badbit);//bad	
		__throw_exception_again;//throw exception
	      }
	    catch(...)
	      { this->_M_setstate(ios_base::badbit); }//bad
	    if (__err)
	      this->setstate(__err);//error
	  }
	return *this;
      }
It's been previously recommended you read Wikipedia's description of streams. Have you done that? There's just too much to say about streams, and it's all pretty much there.
Last edited on
Topic archived. No new replies allowed.