I have a class that have only one attribute (a char* str) because I want to have a Mystring class that mostly works with cstyle strings. I paste just this code because I have a curiosity that can help me very much in a future program and I can't find the answer anywhere.
There is a posibility for me to modify this code (I don't know about exceptions yet and things like that) so that I can get the full string? I think it's something about the null character but I really don't get it... I just learned to overload operators but I can't figure out how to get a full string instead of a single word...
std::istream& operator>>(std::istream& is, Mystring& source) {
char* tempstr = new char[1206];
is >> tempstr;
source = Mystring{ tempstr };
delete[] tempstr;
return is;
}
Thank you for your help and time!