My problem is with the following test code:
#include<string >;
std::string TestBuff;
TestBuff.append ("A + B <==> C + D");
std::cout << "TestBuff.lengt h():" << TestBuff.length () << endl;
std::cout << TestBuff.substr (0,5) << endl;
std::cout << TestBuff.substr (6,10) << endl;
The output:
TestBuff.length ():16
A + B
<==> C + D
The last line of output is what seems like a mistake to me. The output
should be: " <==>" but instead the entire remaining line is printed
out. I would expect the output if 10 were greater than the buffer
length, but its not.
???
Any advice here?
Thanks,
ent
#include<string >;
std::string TestBuff;
TestBuff.append ("A + B <==> C + D");
std::cout << "TestBuff.lengt h():" << TestBuff.length () << endl;
std::cout << TestBuff.substr (0,5) << endl;
std::cout << TestBuff.substr (6,10) << endl;
The output:
TestBuff.length ():16
A + B
<==> C + D
The last line of output is what seems like a mistake to me. The output
should be: " <==>" but instead the entire remaining line is printed
out. I would expect the output if 10 were greater than the buffer
length, but its not.
???
Any advice here?
Thanks,
ent
Comment