将控制台输出镜像到c ++中的文件 [英] Mirror console output to file in c++

查看:97
本文介绍了将控制台输出镜像到c ++中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++中,是否有一种聪明的方式来将输出从stdout映射到控制台和文件?
我希望有一种方法,像在这个问题

In C++, is there a smart way to mirror output from stdout to both the console and the file? I'm hoping there is a way to do it like in this question.

编辑:只需使用标准库就可以做到这一点$ b

It would be nice to be able to do this with just the standard libraries (ie: no boost)..

推荐答案

或者,只需启动您的程序,将其连接到 tee 命令。

Alternatively, just start your program so it's piped to the tee command.

这篇关于将控制台输出镜像到c ++中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆