Subject: Re: [boost] using of circular_buffer
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2012-03-28 15:48:11
> when debugging, i got some errors. do i use the circurlar
> buffer wrong?
These posts are not on topic. You're hitting many basic C++ errors and this list is not the place to learn the language. Refer to http://www.boost.org/community/policy.html for details.
> void ConsoleText::FormatOutput()
> outPutText = "";
> for (int i = 0; i < textBuffer->buffer.size(); i++)
> outPutText += textBuffer->buffer.front();
> outPutText += "\n";
In this case, you're never advancing through textBuffer->buffer's elements but rather calling front() repeatedly. You need to call pop_front() to move to the next element. I have no idea what outPutText is, but it may be misbehaving when you make it too large.
> on this call:
> i'll get a segmantion fault, which is an indicator of that
> textBuffer wasn't instantiated well.
For that to segfault, I suspect your memory is trashed. Is textBuffer still a valid pointer in that case? Have you actually used a debugger?
Please consider posting to comp.lang.c++.moderated or somewhere else to work on such problems.
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk