I just edited my code posts with update code. I changed a lot of stuff and commented other stuff out.
The problem I'm having right now is with "test 17" in the driver program:
Code:
void test17()
{
system("cls");
cout << "17. Testing: Substr function." << endl << endl;
csis << "17. Testing: Substr function." << endl << endl;
String s17("Jai Guru Dev"), t17;
s17.setName("s17");
t17.setName("t17");
t17 = s17.substr(4, 8);
s17.print();
t17.print();
wait();
}
I highlighted the probelm areas. The "substr(x,y)" function is supposed to take the string from the object, start at x position, and continue for y spaces making a new string with those characters. So in this instance t17 should equal "Guru Dev". For some reason when I compile it and run it t17 is equal to "Guru Dev Morgan". I have no idea how "Morgan" got there.
I did some debugging and found that when I try and make a new character pointer to hold the memory something screws up and it makes a bigger character array and just fills it with junk. I've been trying to fix it but I can't figure out how. If you could help me that would be awesome!!!