Boost logo

Boost :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-02-28 17:39:36


> 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 

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