Convert std::string to integer

后端 未结 4 671
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 08:27

I\'m trying to convert a std::string stored in a std::vector to an integer and pass it to a function as a parameter.

This is a simplified vers

4条回答
  •  孤城傲影
    2021-02-05 08:49

    Use stringstream from standard library. It's cleaner and it's rather C++ than C.

    int i3;
    std::stringstream(record[i]) >> i3; 
    

提交回复
热议问题