在Ostream参数上使用ofstream :: open

时间:2019-01-20 18:53:08

标签: c++ ostream

我具有生成报告的功能:

void generate_structure_report(const Factory &factory, std::ostream &outputloc)

项目要求是我必须能够将它们打印到std::couttxt file,这就是为什么我将参数作为std::ostream&传递的原因。

问题是-如果std::ostream &outputloc是一个文件(std::ofstream),我必须open()close()对其进行适当的设置。我应该使用什么命令来区分这两个输出位置?

0 个答案:

没有答案