Boost logo

Boost Users :

Subject: Re: [Boost-users] how to know when eof has been reached?
From: Roland Bock (rbock_at_[hidden])
Date: 2010-02-12 05:12:04


eial_at_[hidden] wrote:
> hello
> I've implemented a base64 decoder using input_filter, now for some reason I can't seem to cause it to end when reaching EOF.
> I need to read the entire that but using >> returns what is in between spaces, so I've created a function that loops on the stream to get the data.
> using a bool flag haven't worked because for some reason, the value isn't saved between the functions so I've tried with a specific char, that didn't worked too, how can I know when I've reached EOF?
> the headers and source can be found at: http://gitorious.org/open-source-soccer-manager/ossm/blobs/master/src/Utilities/Base64Decoder.hpp http://gitorious.org/open-source-soccer-manager/ossm/blobs/master/src/Utilities/Base64Decoder.cpp
> thanks.
>
>
Hi,

since you are using a filtering istream, why don't you implement your
filter according to the tutorial? E.g.:

http://www.boost.org/doc/libs/1_42_0/libs/iostreams/doc/tutorial/multichar_filters.html

You could then add your filter to the filter chain of a filtering stream
and you're done.

HTH

Roland


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