Solved

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

Posted on 1998-07-17
2
164 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

856 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