如何从 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.
为 MFC 应用的调试输出创建控制台
别忘了FreeConsole 一次你已经完成了.
Dont forget to FreeConsole once you're done with it.
相关文章