
15 Jul
2008
15 Jul
'08
6:01 p.m.
Aljaz schrieb:
Hello
Why will the following code make my application crash:
int main(){ std::string s = "Field 1 \"putting quotes around fields, allows commas\",Field 3";
boost::escaped_list_separator<char> sep("\"\'", " ,;", "\"\'"); boost::tokenizer<boost::escaped_list_separator<char> > tok(s, sep);
for(boost::tokenizer<boost::escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg){ std::cout << *beg << "\n"; } }
What am I doing wrong? Many thanks in advance!
Aljaz
Maybe you try to surround the code in main with try { ... } catch(std::exception& e){ std::cout << e.what() << std::endl } Possibly the tokenizer throws an exception that shows the reason.