[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



On Sat, 27 Nov 2004, Fletch wrote:

> I want to say that you should be able to declare an ostream and assign
> either an ofstream or cout as desired.
> 
> ostream& log;  <-------[initializing to 'cout' => same whine]-----+
>                                                                   |
> if( logfilename ) {                                               |
>   ofstream logfile( logfilename.c_str() );                        |
>   log = logfile;                                                  |
    ^^^^^^^^^^^^^---- This doesn't compile. I get:                  |
                                                                    V
Switchbox.cpp:38: `logging' declared as reference but not initialized
/usr/include/c++/3.2.3/bits/ios_base.h: In member function 
   `std::basic_ios<char, std::char_traits<char> >& std::basic_ios<char, 
   std::char_traits<char> >::operator=(const std::basic_ios<char, 
   std::char_traits<char> >&)':
/usr/include/c++/3.2.3/bits/ios_base.h:427: `std::ios_base& 
   std::ios_base::operator=(const std::ios_base&)' is private
Switchbox.cpp:133: within this context
make: *** [Switchbox.o] Error 1

> } else {
>   log = cout;
> }

 - John Mills
   john.m.mills at alum.mit.edu


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="01039" href="msg01039.html">[ale] Q: directing stream I/O _the_C++_way_</a></strong>
<ul><li><em>From:</em> jknapka at kneuro.net (Joe Knapka)</li></ul></li>
<li><strong><a name="01040" href="msg01040.html">[ale] Q: directing stream I/O _the_C++_way_</a></strong>
<ul><li><em>From:</em> jknapka at kneuro.net (Joe Knapka)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="01033" href="msg01033.html">[ale] Q: directing stream I/O _the_C++_way_</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg01036.html">[ale] Q: directing stream I/O _the_C++_way_</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg01038.html">[ale] Re: Linksys WRT54g alternate firmware</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg01036.html">[ale] Q: directing stream I/O _the_C++_way_</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg01039.html">[ale] Q: directing stream I/O _the_C++_way_</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#01037"><strong>Date</strong></a></li>
<li><a href="threads.html#01037"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>