当前位置:网站首页>Using printf in MFC
Using printf in MFC
2022-04-23 06:43:00 【~Ha】
Step one :
Add the following code to the dialog initialization function OnInitDialog() in
AllocConsole();// The console debugging window opens
freopen("CONOUT$", "w", stdout);// Enable Chinese console output support
Step two :
Add the following code to the exit function
FreeConsole(); // Release console resources
If you use the default cross in the upper right corner, exit the interface , You can add the following code directly
void CMFCprintfDlg::OnClose()
{
// TODO: Add message handler code and / Or call the default value
FreeConsole(); // Release console resources
exit(0);
CDialogEx::OnClose();
}
Be careful :
The function used for printing is C Standard output function of language printf, stay vs If you use printf Still need to be in Engineering properties -> Configuration properties ->C/C++ -> Preprocessor definition Add **_CRT_SECURE_NO_WARNINGS**
版权声明
本文为[~Ha]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230548244798.html
边栏推荐
- cv_bridge 与opencv 版本不匹配的解决
- C [document operation] PDF files and pictures are converted to each other
- PM2 deploy nuxt project
- 产生随机数
- 进程间通信-互斥锁
- Wechat applet request encapsulation
- OpenCV使用 GenericIndex 进行 KNN 搜索
- [stepping on the pit] MELD in win11 wsl2 cannot be used normally. Problem repair
- ArcGIS license错误-15解决方法
- Generate random number
猜你喜欢
Installation of GCC, G + +, GDB
Graduation project, curriculum link, student achievement evaluation system
PN结、二极管原理详解与应用
【UDS统一诊断服务】(补充)五、ECU bootloader开发要点详解 (2)
逻辑回归原理及代码实现
for()循环参数调用顺序
[UDS unified diagnostic service] IV. typical diagnostic service (2) - data transmission function unit
[UDS unified diagnosis service] i. diagnosis overview (3) - ISO 15765 architecture
【UDS统一诊断服务】五、诊断应用示例:Flash Bootloader
类的继承与派生
随机推荐
【学习一下】HF-Net 训练
日志写法(带时间)
copy constructor
【OpenCV】使用 FileStorage 读写 Eigen 向量
C [document operation] PDF files and pictures are converted to each other
[UDS unified diagnosis service] i. diagnosis overview (3) - ISO 15765 architecture
Camera calibration: key point method vs direct method
产生随机数
圆整 round 的一点点小细节
Shell脚本 &&和||的使用
[opencv] use filestorage to read and write eigenvectors
Call procedure of function
LaTeX配置与使用
C语言循环结构程序
对象数组与对象指针
[ThreadX] ThreadX source code reading plan (I)
[untitled]
[stepping on the pit] MELD in win11 wsl2 cannot be used normally. Problem repair
三极管原理及特性分析
【UDS统一诊断服务】二、网络层协议(1)— 网络层概述与功能