Solved

Debugging problem. operator+=(const char rhs) crashes.

Posted on 1998-07-17
2
165 Views
Last Modified: 2010-04-01
Thank you trestan.
0
Comment
Question by:TylerRick
2 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1168088
If you wish to award points to a specific expert, please say so in the title!
0
 
LVL 8

Accepted Solution

by:
trestan earned 100 total points
ID: 1168089
Thanks. Do not forget reject the original one. Otherwise you will not get your points back. The follows listed here for memo.
It is depends on how you define the length of the CString, especially in your constructor:
CString::CString(unsigned short len)
{
   itsLen = len+1; //You have declare itsLen.
   itsString = new char[itsLen ];
   for (unsigned short i = 0; i<itsLen; i++)
      itsString[i] = '\0';
}
Then the itsLen will be the actual length of the CString. Later, just itsLen+1 is enough. I think you should also define CString1 += CString2. However, you have known what is a complete set of operators. Good luck.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IdTCPClient1->Disconnect(); not working 3 86
Create a path if not exists 7 105
show out valin of json for debugging in visaul c++ 1 47
How do i run a c++ file? 15 51
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question