Copy data from fstream to stringstream with no buffer?

后端 未结 5 1449
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-01 19:02

Is there anyway I can transfer data from an fstream (a file) to a stringstream (a stream in the memory)?

Currently, I\'m using a buffer, but th

5条回答
  •  情书的邮戳
    2021-02-01 19:29

    If you're using Poco, this is simply:

    #include 
    
    ifstream ifs(filename);
    string output;
    Poco::StreamCopier::copyToString(ifs, output);
    

提交回复
热议问题