By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,134 Members | 1,942 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,134 IT Pros & Developers. It's quick & easy.

use of strstream object of standard lib

P: n/a

I am using ostrstream object.I am using the str() function to get the char
buffer. The function is returning the pointer of char buffer , but it is
adding some garbage at the end. This behaviour is not predictable .
Sometimes it is returning the char buffer correctly , sometimes it is
returning the char buffer and some garbage attached to it at the end.I am
initialising the ostrstream object by fill('\0') function.

Can U please suggest some solution.

I am writing the code below for reference.

tBool clClusterCheckResults::logUplinkZeroCellError(cons t clCluster&
RBINTValOrderedVector <int> a_vZCsNotRetained)
bool a_bReturnValue(false);
ostrstream myBuffer;
a_bReturnValue = true;

myBuffer << corfCluster // << opearor is overloaded for clCluster class
<< " WARNING: The Cluster has no Uplink ZeroCells. "
<< " The following Zero Cells with Cobounding OC, with Uplinks are not
retained "
<< " in the higher level. (ZC Index) - ";

for(int iZeroCellIterator = 0 ;
iZeroCellIterator < a_vZCsNotRetained.length() ;
myBuffer << a_vZCsNotRetained[iZeroCellIterator] << " ";

myBuffer << "END\n";
cout<< "``````````PRINTING mybuffer logUplinkZeroCellError`````````\n";
cout<< myBuffer.str(); //Here the output is coming errorous
cout<< "``````````OVER``````````````````````````````````` ``````````\n";



Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
News For Mohan wrote:
Hi, [...]

Oh, so you actually decided to start a new thread... Well, see my
reply to your earlier posting.
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.