freopen实现stdout/stderr的重定向方法
2016-01-29 19:28
309 查看
static void redirect_stdio(const char* filename) {
// If these fail, there's not really anywhere to complain...
freopen(filename, "a", stdout); setbuf(stdout, NULL);
freopen(filename, "a", stderr); setbuf(stderr, NULL);
}
// If these fail, there's not really anywhere to complain...
freopen(filename, "a", stdout); setbuf(stdout, NULL);
freopen(filename, "a", stderr); setbuf(stderr, NULL);
}
相关文章推荐
- Linux常用命令和快捷键总结(我的工作总结)
- 运维界最牛的一篇2015年总结!看后震惊了!
- Linux 标准Shell Bash 的基本功能
- centos编译yaf时make出错
- Linux cp 实现强行覆盖
- Linux cp 实现强行覆盖
- (转)软件架构师应该知道的97件事
- Linux Clock & Time
- Linux 中的零拷贝技术 三
- 解决Linux中/etc/resolv.conf文件总是自动改回的问题
- docker: 解决centos7下cgroup.procs: no such device的错误
- CentOS 查看硬件信息
- tomcat7.0 远程DEBUG
- VS2012发布网站详细步骤
- USB集腋成裘:从Linux PC角度看sys.usb.config为none时的Android设备
- S-Docker_02_基本概念_02_容器
- Apache OFBiz技术架构
- Linux 内核0.11 系统调用详解(上)
- Linux常用指令---Find查找
- linux 下使用ndk-build编译android使用的c++静态库