Boost logo

Boost Users :

Subject: Re: [Boost-users] using my sink to write to the file.
From: Patel, Anand (Anand.Patel_at_[hidden])
Date: 2009-09-17 14:29:19


Thank you for your quick response and it was helpful. Finally I
understood why I was getting errors.
Basically, I want to stream binary data to some file, and I must use
SINK mechanism of boost, can someone please advise me on that.

Thank you,
-Anand

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Eric MALENFANT
Sent: Thursday, September 17, 2009 2:24 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] using my sink to write to the file.

Patel, Anand wrote:

> I have used Sink class example and now I am trying to use that as my
> sink device for the stream object.
>
> char* file_name = "c:/devel/output/file_one.txt";
>
> typedef container_sink <std::iostream> some_sink;
>
> stream<some_sink, std::char_traits<char>> my_file_stream;
>
> last line I get many errors as following:
>
> 1>c:\documents and settings\user\my documents\visual studio
> 2008\projects\filereaderwriter\sink.h(11) : error C2039: 'value_type'
> : is not a member of 'std::basic_iostream<_Elem,_Traits>' 1>
> with 1> [
> 1> _Elem=char,
> 1> _Traits=std::char_traits<char>
> 1> ]
> 1> c:\program
> files\boost\boost_1_39\boost\iostreams\traits.hpp(176) : see reference
> to class template instantiation 'foobar::container_sink<Container>'
> being compiled 1> with
> 1> [
> 1> Container=std::iostream
> 1> ]
[snip]

Assuming that you refer to the container_sink defined in
libs/iostreams/example/container_device.hpp,
container_sink<std::iostream> is an invalid instantiation since, as the
container_sink comment states: "Model of Sink which appends to an
STL-compatible sequence." and std::iostream is not an STL-compatible
sequence.
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net