How to force std::stringstream operator >> to read an entire string?

后端 未结 6 1564
鱼传尺愫
鱼传尺愫 2021-01-05 08:01

How to force std::stringstream operator >> to read an entire string instead of stopping at the first whitespace?

I\'ve got a template class that stores a value read

6条回答
  •  粉色の甜心
    2021-01-05 08:20

    Where do you want it to stop? If you want to read a whole line you probably need getline function, if you need an entire string stored in the streamstring object your choise is ostringstream::str method.

提交回复
热议问题