Boost logo

Boost :

From: Brian Braatz (brianb_at_[hidden])
Date: 2005-02-28 18:54:28

> -----Original Message-----
> On Behalf Of Jonathan Turkanis
> Sent: Monday, February 28, 2005 3:09 PM
> Brian Braatz wrote:
> > First off THANK YOU Johnathon Turkanis for help with "tee" earlier.
> > That saved me a great amount of pain.
> Glad to be of service ;-)
[Brian Braatz Writes:]

> > Below is part of what I am trying to use it with.
> >
> > My next question is what is the best way to deal with an "output"
> > device having a different cr\lf than another one?
> Have you tried to use a newline filter:

[Brian Braatz Writes:]

I have this sinking feeling this is like when I am standing in front of
the fridge and say "Honey, WHERE IS THE MILK?"

> ?
> I'm not familiar with the function OutputDebugString, but you might be
> able to
> do this:
> struct debug_out_sink : boost::iostreams::sink
> {
> void write(const char* s, std::streamsize n)
> {
> std::string s(s, n);
> OutputDebugString(s.c_str());
> }
> };
> void Test_Profile()
> {
> // Note: library now uses namespace iostreams
> using namespace boost::iostreams;
> filtering_ostream out;
> std::ofstream log("log.txt");
> debug_out_sink dbosink;
> out.push(tee(log));
> out.push(tee(std::cout));
> out.push(newline_filter(newline::windows));
> out.push(dbosink);
> out << "LINE ONE" << endl
> << "Next line" << endl
> << "third line" << endl;
> }
> Jonathan

[Brian Braatz Writes:]

OutputDebugString() is a win32 function, basically when you build your
app and hit the "debug" button in the IDE, it launches your app as a
child process. If your app calls OutputDebugString() the text sent is
marshaled across the process boundaries back to the parent process (MSVC
debugger) and then it puts the string into the "debug window" in the
(I point this out because it is semi-important to note that the process
OutputDebugString has to go through is SLOW. I.e. just for reference,
you would NOT want to call OutputDebugString() for each char)

The problem with above, IF I UNDERSTAND iostreams properly, is that I
just want a filter on the debug_out_sink because it needs the \r\n.
Everything else needs a \n.

Doesn't the above line apply the filter to everything?

Do I need to weave in the filter on the debug_out_sink class? (either by
"has a" or "is a")?

What I am after is the "user" of debug_out_sink can just "push" it in
without having to know about \r\n vs \n weirdness.

Boost list run by bdawes at, gregod at, cpdaniel at, john at