Board index » cppbuilder » Strange behaviour of stringstream in BCB5
Old Wolf
CBuilder Developer |
Strange behaviour of stringstream in BCB52007-02-15 06:41:49 AM cppbuilder83 My code looks like this: void func(std::ostream &out, std::istream &in) { std::stringstream ss; ss << in.rdbuf(); char ch; while ( ss.get(ch) ) out.put(ch); } (The code is structured this way because there is some other processing going on that is not part of the problem so I have omitted it). The problem is that about 1 time in 100,000 the output file is half filled with null characters. The file is about 13K in size; the first 8192 bytes of output are correct and the rest of it is null characters. What might be going on here? Do I need to do any sort of flag operation on 'ss' after reading into it before I can get characters out of it? Are there any known bugs with this symptom? |