how to know when eof has been reached?
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/Utilit... http://gitorious.org/open-source-soccer-manager/ossm/blobs/master/src/Utilit... thanks.
eial@cs.bgu.ac.il 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/Utilit... http://gitorious.org/open-source-soccer-manager/ossm/blobs/master/src/Utilit... 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_f... You could then add your filter to the filter chain of a filtering stream and you're done. HTH Roland
On Fri 12 Feb 12:12 2010 Roland Bock wrote:
eial@cs.bgu.ac.il 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/Utilit... http://gitorious.org/open-source-soccer-manager/ossm/blobs/master/src/Utilit... 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_f...
You could then add your filter to the filter chain of a filtering stream and you're done.
HTH
Roland _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I had no idea there was a multi char filter, thanks alot! will look into it.
participants (2)
-
eial@cs.bgu.ac.il
-
Roland Bock