How to print an entire istream to standard out and string

后端 未结 5 737
既然无缘
既然无缘 2021-01-03 22:39

How do you print an istream variable to standard out. [EDIT] I am trying to debug a scenario wherein I need to ouput an istream to a log file

5条回答
  •  粉色の甜心
    2021-01-03 23:38

    You need to read from it, and then output what you read:

    istream stm;
    string str;
    stm >> str;
    cout << str;
    

提交回复
热议问题