Possible Duplicate:
C++: How to split a string?
Hi friends,i need to split a string containing comma seperated values and have to store each value to a variable to use further in the program.I have my code as following : but i am getting error in my code :
string myString = ........// i am getting the string from a function
string::iterator it = myString .begin();
while ( it != myString .end() )
{
if ( *it == ',' )
{
string element =*it++; //i can't do such type of conversion.but then how can
i get each value ?
if(element.empty())
{
}
}
}