[Boost-bugs] [Boost C++ Libraries] #2998: Make file_sink flushable

Subject: [Boost-bugs] [Boost C++ Libraries] #2998: Make file_sink flushable
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-05-07 01:02:40

#2998: Make file_sink flushable
 Reporter: Andrew Schweitzer <a.schweitzer.grps_at_[hidden]> | Owner: turkanis
     Type: Feature Requests | Status: new
Milestone: Boost 1.39.0 | Component: iostreams
  Version: Boost 1.38.0 | Severity: Not Applicable
 Keywords: |
 file_sink is hard to use as a debug log, since it does not flush.

 For example, when used when pushed into a filtering_ostream with cout, if
 flush is not called, characters don't appear on console or in file in a
 timely fashion. If flush is called, the characters on the console appear
 but not those in the file, because file_sink does not implement Flushable
 concept, and doesn't flush.

 This code:
     filtering_ostream fo;

     file_sink fsink("out.txt");
     tee_filter<file_sink> tee_fsink(fsink);


     fo << "some text";

 is very useful for arbitrary chains of debug logs, but not currently

 The same issue applies to file, file_descriptor, and file_descriptor_sink.

 If there is some reason these classes should not be modified to made
 flushable, then it seems easy to make flushable_* versions. Example of
 this attached, which was copied from file.hpp.

 I also tried to add flushable_file_descriptor, by privately inheriting
 from file_descriptor, and adding a flush call which calls
 ::FlushFileBuffers on handle()... but so far that doesn't seem to work, so
 not attaching.

 Discussion at

Ticket URL: <https://svn.boost.org/trac/boost/ticket/2998>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC