Hi below is my function:
string Employee::get_print(void) {
string out_string;
stringstream ss;
ss << e_id << " " << type << endl;
out_string = ss.str();
return out_string;
}
e_id
and type
are int
and they contain values from the class Employee. But when I pass them into the stringstream they just clear the string when I try to out put it. But if I don't have a int
in the ss << "Some text" << endl;
this output fine. What am I doing wrong =S
//Edit
Ok; This is the calling code:
tmp = cur->get_print();
Where tmp is a string and cur is an Employee Object.
This code...
stringstream out;
out << "Test " << e_id << " " << e_type;
return out.str();
Retruns "Test " and nothing else. If I take out "Test " <<
my returned string is ""
I'm using GCC 4.2 on Mac OS/X 10.6.2 if that makes any difference.