Boost logo

Boost :

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


Yes I think so, (still trying to get my head around iostreams :) )

What I am working on:

I am integrating Christopher's Profiler lib into a large project. The
project is based on MFC (GUI Library- cout doesn't work here), so I was
using the iostreams to allow for his profiler lib to generate reports to
both the MSVC DEBUG window and a log file. The nice thing about the
debug window, is that I can immediately "see" the results" of it (as
opposed to having to continually open the file)

Thanks to Chris and Jonathon for their help in today's chapter of death
defying journeys with boost libraries......

-----Original Message-----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of christopher diggins
Sent: Monday, February 28, 2005 2:40 PM
To: boost_at_[hidden]
Subject: Re: [boost] Iostreams Question: Best way to output
towin32debugger\outwindow ?

> My next question is what is the best way to deal with an "output"
device
> having a different cr\lf than another one?

Hi Brian,

My suggestion is to create another separate filter which does nothing
but
convert \n to \r\n and add it to the chain:

class newline_conversion_filter : public output_filter {
public:
  template<typename Sink>
  void put(Sink& dest, int c)
  {
    if (c == '\n')
    {
      boost::io::put(dest, '\r');
      boost::io::put(dest, '\n');
    }
    else
    {
      boost::io::put(dest, c);
    }
  }
};

Does this help?

--
Christopher Diggins
http://www.ootl.org 
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk