Boost logo

Boost Users :

From: Meryl Silverburgh (silverburgh.meryl_at_[hidden])
Date: 2007-05-25 12:38:12


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<char,
std::char_traits<char>, std::allocator<char> >' to 'const char*' for
argument '1' to 'int atoi(const char*)'


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