I know it's been a while since anyone has posted to this thread but I
found
something that others may find interesting
http://cpptips.hyperformix.com/cpptips/multistream
Also for iostream manipulators
http://cpptips.hyperformix.com/cpptips/manipulatorI
http://cpptips.hyperformix.com/cpptips/manipulatorII
http://cpptips.hyperformix.com/cpptips/manipulatorIII
----- Original Message -----
From: "OROSZI Balázs" <or...@vp...>
To: <dev...@li...>
Sent: Monday, February 23, 2004 2:32 PM
Subject: Re: [Dev-C++] Creating a stream
> David McKen wrote:
> > I am looking to creating my own C++ stream class.
> >
> > For now all I want to do is overload the << operator so I can
send
> > data to a file and the screen, this is to try to prevent:
> >
> > cout << x;
> > log_file << x;
> >
> > Essentially I want to do something like:
> > my_stream log_out("log.txt");
> > log_out << x; //Sends to both screen & log.txt.
> >
> > Wrapping this in a function is not exactly the best solution as I
> > lose the ability to use the manipulators or I would have to fall
back
> > to using variable argument lists and sprintf().
> >
> > Does any one know a tutorial or book that could help me?
>
> Not exactly a tutorial, but NeoEngine has it's own logging system,
which
> is exactly the same, what you would like to do. Download
> neoengine-0.7.0.tar.bz2 from it's website:
>
> http://neoengine.sourceforge.net/index.oldsite.php
>
> and look at the LogSink classes. They use (guess what :) log sinks.
You
> attach sinks to the logger, and it writes to those sinks, which are
> attached (log file, dos console, etc.). It uses the << operator. It
also
> has different log levels (info, warning, error, debug, etc.).
> Though it is a small part of the 3D engine, yet I think it is
powerful,
> and easy to "detach" from the rest of the engine, as it is
independent
> from the engine. It is even separately stored in logstream.cpp and
> logstream.h
>
> Look at the first and second tutorials on the neoengine website (1.
> Init&Exit, 2. RenderPolygon), as they mention how to use the
logging
> system. Just disregard the 3D stuff.
>
> Hope that helps.
>
> --
> Greetings,
> Balázs
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id56&alloc_id438&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
|