如何将标准输出重定向到文件并以表格形式显示? [英] how to redirect stdout to a file and display it in form?

查看:105
本文介绍了如何将标准输出重定向到文件并以表格形式显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有ATL,CLR或MFC的Win32编程.我需要将stdout登录到文件,但更重要的是,将其显示在窗体的正文中.
1. freopen可以将stdout重定向到文件,但只能以独占方式进行重定向,以便其他文件描述符或进程都无法将其打开以进行读取.
2.不要在表单主体中显示标准输出.
3.使用freopen后,如果我使用相同的FILE *进行读取& ;;写,因为我需要使用fseek来向后移动指针n,所以我无法同步线程,因为标准输出不在容易控制的范围内.
请问如何实现我的目标?谢谢你. (尽管我想我正在使用CRT方式,但我更喜欢使用C ++方式来完成所有这些工作.)

Win32 programming w/o ATL, CLR or MFC. I need to log stdout to a file, but more importantly, to display it in the form's body.
1. freopen can redirect stdout to a file, but exclusively, so that no other file discriptors or processes can open it to read.
2. donno how to display standard output in form body.
3. after using freopen, if i use the same FILE* for read & write, because i need to use fseek to move pointer back n forth, i cannot synchronize the threads, since standard output is not in easy control.
how to achieve my goal, please? thank you. (though i suppose i'm using a CRT way, i prefer C++ way to do all this.)

推荐答案

您的意思是说您想重定向控制台输出到文件或其他内容.

感谢

Do you mean to say you wann redirect your console output to a file or something else.

Thanx


这篇关于如何将标准输出重定向到文件并以表格形式显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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