25 May
2007
25 May
'07
4:58 p.m.
"Meryl Silverburgh"
Hi,
I have the following loop to tokenize a string. But how can I pass the sub-string to ato()?
for(boost::tokenizer<>::iterator beg=tok.begin(); beg!=tok.end();++beg){ int value = atoi(*beg);
cout << value << "\n"; i++; }
I get this error, in my code: : error: cannot convert 'const std::basic_string
' to 'const char*' for argument '1' to 'int atoi(const char*)'
Try: int value = atoi(beg->c_str()); - Dennis