String conversion - help

Hello guys,

I need to split a string line into a vector of strings, and after that I need to save one index of vector into an int variable. I am doing like showed bellow but I am having error on function "atoi" for conversion from string to int.

ERROR: FileStream.cpp:69: error: invalid conversion from 'int (*)(const char*)' to 'int'


Can anyone state why and please say the right way?

Thanks very much!

1
2
3
4
5
6
7
8
9
10
11
                std::string buf;
                std::stringstream ss(output);
                
                std::vector<std::string> tokens;
                
                while(ss >> buf) {
                    tokens.push_back(buf);
                }
                
                metaTable table;
                table.numberOfFields = std::atoi tokens[2];
Topic archived. No new replies allowed.