【发布时间】:2015-01-31 18:48:58
【问题描述】:
好的,我读到了,如果我们有一个字符串 s =" 1 2 3"
我们可以做到:
istringstream iss(s);
int a;
int b;
int c;
iss >> a >> b >> c;
假设我们有一个包含以下内容的文本文件:
测试1
100 毫秒
测试2
200 毫秒
测试3
300 毫秒
ifstream in ("test.txt")
string s;
while (getline(in, s))
{
// I want to store the integers only to a b and c, How ?
}
【问题讨论】:
标签: c++ istringstream