If this is how the constructor really looks like, then "Mybuffer is private to W_stream."" is not true. You are creating new variable mybuff, which is different from this->mybuff. This new variable is destroyed when constructor exits, so the_stream keeps invalid buffer pointer. Remove the "char mybuff[]" declaration from constructor.
Another thing:
the_stream->rdbuf()->pubsetbuf(mybuffer,265536);
the_stream->rdbuf()->pubsetbuf(mybuffer,265536);
To copy to clipboard, switch view to plain text mode
use sizeof() instead of hard-coded numbers:
the_stream->rdbuf()->pubsetbuf(mybuffer,sizeof(mybuff)/sizeof(char));
the_stream->rdbuf()->pubsetbuf(mybuffer,sizeof(mybuff)/sizeof(char));
To copy to clipboard, switch view to plain text mode
Its easier to correct the number in one place.
Bookmarks