好的,我读到如果我们有一个字符串 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 ?
}