stringstream实现数据类型转换

 

std::stringstream stream;

int first, second;

stream<< "456"; //插入字符串

stream >> first; //转换成int

stream.clear(); //在进行多次转换前,必须清除stream

stream << " 10000"; //插入bool值

stream >> second; //提取出int

 

没有更多推荐了,返回首页