zoukankan
html css js c++ java
QT中printf输出不同步的解决办法
c程序中的printf在应用程序输出窗口中不同步输出。通常是当程序执行完才会把printf的输出一下子全出来。调试程序不方便。
经测试是输出到stdout的字符只有超过4096才输出一次。
解决方法(二选一即可):
1. 在程序开始处增加:setbuf(stdout, NULL);
2. 每个printf后增加一条fflush(stdout);
参考网址:
https://forum.qt.io/topic/10654/solved-printf-scanf-not-working
http://www.pixelbeat.org/programming/stdio_buffering/
运行环境:
Ubuntu16.10+QT Creator 4.02
查看全文
相关阅读:
【JLOI 2015】城池攻占
【BalticOI 2004】Sequence
罗马游戏
《STL源码剖析》STL迭代器分类
《Effective C++》模版与泛型编程
《Effective C++》继承与面向对象设计
《Effective C++》实现 章节
[C++]const_cast,dynamic_cast,reinterpret_cast,static_cast转型
[C++]default constructor默认构造函数
[C++]union联合体总结
原文地址:https://www.cnblogs.com/chinasoft/p/15251506.html
最新文章
ubuntu下安装与卸载qt的方法
linux ssh scp 命令
c/c++编译时,指定程序运行时查找的动态链接库路径
ubuntu 制作deb 包
Ubuntu 14.04 在桌面上双击运行shell 脚本文件
RabbitMQ 入门
Spring boot 2.x 中使用redis
spring boot 中 Cache 的使用
vbs 入门
Centos 7.5 安装 Mysql8.0.14
热门文章
Java 调用系统系统可执行文件
spring boot 中 2.X 的跨域请求
已经使用过的命令
Java 8 有哪些新特性
Spring boot 中发送邮件
[学习笔记] 各种反演
CodeForces
高斯消元
【CQOI 2016】伪光滑数
【SCOI 2011】棘手的操作
Copyright © 2011-2022 走看看