使用字符串流?

kos*_*tia 3 c++ string stringstream

假设我在C++中有一个stringsteam,我想对它做不同的操作,如:

搜索一系列字符,将文本块转换为int(在行的中间),来回移动get指针等等.

使用stringstreams做这类事情的标准/常用方法是什么?

Don*_*alo 5

您可以使用stringstream :: str()方法返回关联的std :: string对象.然后,您可以对返回的字符串执行所需的操作.