473,383 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

use of strstream object of standard lib

Hi,

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&
corfCluster,
RBINTValOrderedVector <int> a_vZCsNotRetained)
{
bool a_bReturnValue(false);
ostrstream myBuffer;
myBuffer.fill('\0');
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() ;
iZeroCellIterator++)
{
myBuffer << a_vZCsNotRetained[iZeroCellIterator] << " ";
}

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

m_oReport.logErrorMessage(myBuffer);

m_oResultsCounter.incrementErrorCount(
corfCluster.getLevel(),
UplinkZeroCellCheck,

Jul 22 '05 #1
1 1240
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bpb | last post by:
I'm trying to use a string stored in a strstream object as the filename parameter in the open call on an fstream object.. It requires a const char* but no matter what I try I can't seem to get a...
4
by: vishnu mahendra | last post by:
Can anyone please tell me what is the use of "strstream.h" header file and the functions in "strstream.h". where can i find documentation for that header file. thankyou in advance, vishnu.
6
by: vishnu mahendra | last post by:
hello to all, #include<iostream.h> #include<conio.h> #include <strstream.h> void main() { clrscr(); strstream str; char *a = new char; int i;
2
by: derek | last post by:
Hi, I'm trying to compile someone's code which uses ostrstream. I know it's declared in file strstream, but I can't find this file in the /usr/include/c++/3.3.3 directory. There is a file called...
2
by: b83503104 | last post by:
Hi, An old code is using stuff like #include <strstream.h> ostrstream *m_actionStream; and the compiler complained syntax error before `*' token I followed some previous posts and tried...
10
by: Aaron Gray | last post by:
Hi, I have an application that uses 'strstream' in just under half its .cc files, about 10 files. What is the replacement for 'strstream' ? What are my options for replacing it ? Many...
8
by: berkay | last post by:
hi all,i need this header file can anyone send it.thanks all.
5
by: nithya4u | last post by:
I am working on a c++ module, where large amount of data needs to be written to a stream and str() method is been used to assign the value of this to the char*. This produces the intended result....
1
by: srikar | last post by:
Hi all, For the class strstream let the object be line. On an 16 bit machine previously of ANSI standard ststream line line.setf(ios::in); What is need for setting the flag to input....
4
by: morten44 | last post by:
here the output and my Compiler version, It is a basic example from Bjarne Stroustrups homepage, morten@Westparkstr42:~/Bjarne_Stroustrup/06_Chapter_06$ g++ dc_except.c...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.