String

Hi I need to know when a row is over, how do i do it ?

I know that in char the end is presented by "/0"

but what about string ?
std::string has a size() function:

1
2
std::string a = "123";
int b = a.size(); // b = 3 
thanks a lot !!!

and if getline(....) fails what it is returned ?
1
2
3
4
5
 while(getline(ss,part1, ','))
{
do something...

}


can I use it this way ?
and if getline(....) fails what it is returned ?
it sets bits in the stream

can I use it this way ?
due to operator void *( ) of the base class 'basic_ios' you can.

EDIT: using the good() function may be more obvious
Last edited on
Topic archived. No new replies allowed.