Hey fellas, question:
Is is legal to store a class to file when one or more of it's members are of the string type?
I tried doing this and I get a fatal runtime error, in which the string.cc file is brought up and one of the lines highlighted:
Code:
string::traits_type::char_out(os, s[x]);
The full code for the block (with the problem line highlighted) is as follows:
Code:
ostream& RWSTDExport operator<< (ostream & os, const string& s)
{
typename string::size_type x;
if ((os.flags() & ios::adjustfield) == ios::right)
for (x = 0; x < os.width() - s.length(); x++)
string::traits_type::char_out(os, os.fill());
for (x = 0; x < s.length() ; x++)
string::traits_type::char_out(os, s[x]);
if ((os.flags() & ios::adjustfield) == ios::left)
for (x = s.length(); x < os.width(); x++)
string::traits_type::char_out(os, os.fill());
return os;
}
Remember, all the code I have shown you above is from the string.cc header file. (#include <string>).
If anyone has even the foggiest idea of what this means, I'd appreciate your help.