Daniel Lidström wrote:
Hello!
when compiled in debug mode, the following program causes an exception in the file p:\boost_1_33_0\include\boost-1_33\boost\iostreams\detail\ optional.hpp, line 54 (I'm using VC 7.1.3088, Windows XP):
#include <iostream> #include
// sink #include // stream using namespace std;
<snip>
template<int id> class my_sink : public boost::iostreams::sink { public:
std::streamsize write(const char* s, std::streamsize n) { gpOutput->print(id, s); std::streamsize sz = 0; for( const char* p=s; *p; ++p ) sz++; return sz; } };
typedef boost::iostreams::stream
> output; int main() { gpOutput = new Output;
output stream;
stream << "Daniel" << endl;
Here's the problem: you're writing to a stream without opening it. Try: output stream; stream.open(my_sink()); stream << "Daniel" << endl;
return 0; }
Hälsningar, Daniel
-- Jonathan Turkanis www.kangaroologic.com