This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Q] Problem with derived from streambuf class


On Monday 18 October 2004 00:46, Paolo Carlini wrote:
> zaufi@sendmail.ru wrote:
> >If this is normal can you please explain me right way to handle std::endl
>
> Probably there are other ways to deal with this issue, but what I would
> suggest
> now is just reimplementing std::endl.
>
>   template<class charT, class traits>
>     basic_ostream<charT, traits>& endl(basic_ostream<charT, traits>& os);
>
> In the standard, its behavior is: os.put(os.widen('\n')), then
> os.flush(). The
> latter, in turn, boils down to rdbuf()-pubsync(), which simply calls the
> streambuf::sync() virtual. The latter is basically an overflow().
overflow()  is a virtual so I just redefine it in my syslogbuf to append __c 
to string -- now its work fine bcouse basic_streambuf::sputc() call it if 
pptr() == 0 (my case)...
I found this solution after reading one link which I found in source code 
comments ;)

thanx for all your replies ;)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]