Boost logo

Boost Users :

From: Maximilian Matthe (Maxi.Matthe_at_[hidden])
Date: 2008-07-15 14:01:22


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net