Hi all,

I desire to use boost::iostream input and output filters. 
I cannot make the "Filter Usage Examples" (para2.2.2) shown here () to work. 

the following, as far as I can tell, is exactly the same "Ordinary OutputFilter" example shown at (http://tinyurl.com/45bur3o)

struct toupper_filter {
       typedef char                   char_type;
       typedef boost::iostreams::output_filter_tag  category;

       template<typename Sink>
       bool put(Sink& snk, char c)
       {
           return boost::iostreams::put(snk, toupper((unsigned char) c));
       }
   };

the following code is modeled on the code at para2.2.2, "Filter Usage Examples":

int main(int argc, char *argv[])
{
    // read my_input.txt and save uppercase version of text into datastore.txt

    std::ifstream pt_input;
    pt_input.open("my_input.txt");

    std::ostringstream oss;
    oss << pt_input.rdbuf();

    // oss now contains the text stored in input text

    boost::iostreams::filtering_ostream out_stream;

    // the following line is expected to transform the input text to uppercase.
    // instead it causes no text to appear in the output file.  If the following line of
    // code is commented-out then contents of "my_input.txt" is placed in "datastore.txt".
    out_stream.push(toupper_filter()); 

    out_stream.push(boost::iostreams::file_sink("datastore.txt"));
    out_stream.write( oss.str().c_str(), oss.str().length());   

    out_stream.flush();
}

I am obviously doing not adding the toupper_filter into the filter chain correctly.  Can anyone point out what I am doing wrong?

many thanks