Change this:
m_chrString = new char[ length ];
to this:
m_chrString = new char[ length + 1 ];
Remember, you must allocate one more than the length to accomodate the null terminator at the end of the character array.
Hope this helps!
Josh
Change this:
m_chrString = new char[ length ];
to this:
m_chrString = new char[ length + 1 ];
Remember, you must allocate one more than the length to accomodate the null terminator at the end of the character array.
Hope this helps!
Josh
Or the whole computer could ignite in flames (only with the Microsoft(tm) Self-Destruct kit, sold seperately)
- Splat
For some reason the class cuases the simple program I included with the source (I mean real simple program. It has no more than a main.). The problem occures whenever I try to do the following:
code:delete [] m_chrString;
Yes, m_chrString is an array of type char that was create using:
code:m_chrString = new char[ length ];
This is basic stuff, and it has me rether agrivated that I cannot find the fault im my code. Please do not respond with a cratique of my class, just tell me why its crashing the program.