[streams] surplus output generated
Hi all,
the code below using boost::iostream produces unwanted surplus output:
Write: this ist a test output split into two parts
Print: this flushes previous output
Write: another test output
t split into two parts
The last line is a fragment of the first line which should not be
there.
I am using boost 1_39, gcc 4.3.2 [gcc-4_3-branch revision 141291]
What am I doing wrong here ?
BTW: the code is a stripped demo code. Originally, "true" devices are
used instead of the dummy "0", and I use some home-brewn classes
(instead of just "string") which require specialized output handling
depending on the used device, therefore the direct call into the
stream object. However, this makes no difference.
Regards,
Sven
---------------------------------------------------------------------
#include <iostream>
#include
Sven Heithecker escribió:
Hi all,
the code below using boost::iostream produces unwanted surplus output:
streamsize write(const char *s, streamsize n) { cout << "Write: " << s; return(n); }
My guess is you should only read up to n chars. Try copying n chars from s, and outputing those. Agustín K-ballo Bergé.-
Am Samstag, 12. September 2009 schrieb Agustín K-ballo Bergé:
Sven Heithecker escribió:
Hi all,
the code below using boost::iostream produces unwanted surplus output:
streamsize write(const char *s, streamsize n) { cout << "Write: " << s; return(n); }
My guess is you should only read up to n chars. Try copying n chars from s, and outputing those.
Hi, brilliant idea - works like a charm ! Thanx for help. Regards, Sven -- Sven Heithecker GPG Fingerprint: 52F7 06C2 BF51 96CE DFF7 CC89 1A6B DFD5 BEC2 02A6
participants (2)
-
Agustín K-ballo Bergé
-
Sven Heithecker