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.
为 MFC 应用的调试输出创建控制台
别忘了FreeConsole 一次你已经完成了.
Dont forget to FreeConsole once you're done with it.
这篇关于如何从 MFC 程序写入标准输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何从 MFC 程序写入标准输出?


- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 静态初始化顺序失败 2022-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- C++ 协变模板 2021-01-01
- 近似搜索的工作原理 2021-01-01
- 从python回调到c++的选项 2022-11-16
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01