std::string s;
std::stringstream ss;
ss << "a=b+c" << std::endl << "d=e+f";
std::getline(ss, s, '='); // gives me "a"
std::getline(ss, s); /* gives me "b+c" <- just want to peek: don't
want to change state of ss */
std::getline(ss, s, '+'); // BUT still want "b" here, not "d=e"
s
now 包含"a"
现在,如何查看行 ( "b+c"
) 的剩余字符?也就是说,不会导致下一个操作从下一行开始?
(例子是人为的,我知道。)