okay, here's what I have:
here's the test string:
"[email protected]"
I have these calls: The first just copies the string and prints it, the second gets everything before the @ (not including it), and the second gets everything after the @ (not including it).
Code:
Address.CopyTo(0, length, LocalPart.Strng);
Address.CopyTo(0, atPosition, LocalPart.UserName);
Address.CopyTo(atPosition + 1, length - atPosition - 1, Domain.Name);
atPosition is the location of the '@' symbol. Address is said String.
and here's my CopyTo functions:
Code:
void MyString::CopyTo(int startPosition, int length, MyString &destination)
{
while( startPosition != length )
{
destination.Buffer [ startPosition ] = Buffer [ startPosition ];
cout << destination.Buffer[startPosition];
startPosition++;
}
destination.Buffer [ startPosition ] = '\0';
cout << endl;
}
and here's the output:
[email protected]
asf
adhia
see, for some reason, it's not getting the '.net', yet if I print out the length for Domain.Name, it still prints 9 (which is correct)...
it SHOULD be:
[email protected]
asf
adhia.net
what could be going wrong here?
EDIT: I forgot to mention, if I try anything more positive than length - atPosition - 1 for the second CopyTo function call, it prints it out, but then crashes.