如何从一个MFC程序写入stdout? [英] how do I write to stdout from an MFC program?

查看:88
本文介绍了如何从一个MFC程序写入stdout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MFC程序通常不能写入stdout。 MFC在启动期间使用stdout / stdin管道做任何奇怪的事情(例如执行printf(hello);)只是到/ dev / null。

MFC programs can't normally write to stdout. MFC does something weird with the stdout/stdin pipes during startup and anything you write (for example doing a printf("hello");) just goes to /dev/null.

有人知道如何成功地从MFC程序写入stdout?

Does anyone know how to successfully write to stdout from an MFC program?

感谢阅读。

推荐答案

使用 AllocConsole 函数创建一个用于写入的控制台。以下文章介绍如何使用它打印到控制台。

Use AllocConsole function to create a console for writing into. The following article explains how to use it to print to console.

为您的MFC应用程序的调试输出创建控制台

不要忘记 FreeConsole

这篇关于如何从一个MFC程序写入stdout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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