如何从 MFC 程序写入标准输出? [英] how do I write to stdout from an MFC program?
本文介绍了如何从 MFC 程序写入标准输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
MFC 程序无法正常写入标准输出.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 程序成功写入标准输出吗?
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.
别忘了FreeConsole 一次你已经完成了.
Dont forget to FreeConsole once you're done with it.
这篇关于如何从 MFC 程序写入标准输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文