How can I read from memory just like from a file using iostream?

前端 未结 6 1032
醉话见心
醉话见心 2020-12-09 12:41

I have simple text file loaded into memory. I want to read from memory just like I would read from a disc like here:

ifstream file;
string line;

file.open(\         


        
6条回答
  •  孤城傲影
    2020-12-09 13:19

    Use

    std::stringstream
    

    It has an interface to manipulate and read strings just like other streams.

提交回复
热议问题