Overflowing string... any easy way to fix it?
I've been working on a class, and I recently (finally) figured out exactly what was wrong with a certain line of code. My string class variation I'm working on doesn't have enough spaces to hold the new string. The problem is it is a flexible array size, and when it overflows it crashes as a result of some special code in the original class I'm converting from.
Does anyone know an easy way to change the size of a string? I don't mind destroying the character array and starting a new one.
Thats the member function, and it overflows with this if I use oostring instead of a character array (oostring is a string class, I'm making a variation of it that acts as an integer, but has some weird manipulations made easier.):
void ooint::intfcat(const char * Int1)
The idea of the original string class was to make it so that it could expand when needed, but it isn't doing that here. Can anyone help me? The source is attatched, and basically all of it is intact at the moment with oostring renamed as ooint.
100 1001 index out of range: 5 string: 31001
Assertion failed: 0 <= k && k < strlen(CString), file c:\program files\microsoft
visual studio\myprojects\oostring.cpp, line 103
Thanks so much! If you want more details on this, see the older thread: http://cboard.cprogramming.com/showt...threadid=29228