Qt two ways write Debug() into file
来源:互联网 发布:北大光华知乎 编辑:程序博客网 时间:2024/05/18 00:09
Here we can handle we can print different kind of message in file. For example QtDebugMsg, QtWarningMsg etc. We can constantly open a file and print to it and close it. Or we can open it in constructor of a class and flush/close in the destructor of the class. If we want to execute the application and want to get the debug information out then the first one is better (since file will be released). If we want to see the debug informationafter closing the app then second one should be OK.
void debugOutput(QtMsgType type, const char *msg) { QFile debugfile("C:\\Data\\debug.txt"); Q_ASSERT(debugfile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)); switch (type) { case QtDebugMsg: { QTextStream out(&debugfile); out << msg; } break; default : break; } debugfile.flush(); debugfile.close(); } #define TRACE_FUNC_ENTRY qDebug()<< __PRETTY_FUNCTION__ << ">" << endl ;#define TRACE_FUNC_EXIT qDebug()<< __PRETTY_FUNCTION__ << "<" << endl ;
- Qt two ways write Debug() into file
- Two ways to load mysql tables into hdfs via spark
- mysql into outfile ERROR : Can't create/write to file
- write data into a txt file in C#
- 20 ways to debug Qt signals and slots
- 20 ways to debug Qt signals and slots
- read numbers from file and exchange their positions then write into another file
- Qt Write and Read XML File 读写XML文件
- two ways of multiThread
- Sort Colors (two ways)
- File Write
- MySQL into outfile 问题解决:ERROR 1 (HY000): Can't create/write to file
- 解决:CentOS下MySQL执行select ... into outfile ...: Can't create/write to file '...' (Errcode: 13)
- Qt+VS "ErrorC1083Cannot open source file: 'GeneratedFiles\Debug\moc_xxx"
- [agc009c]Division into Two
- Write-Debug 帮助信息
- Two ways to unlock iphone4
- Two ways of using Iterator
- System.map
- 折半查找(二分法查找)
- iPhone导航控制器的重要“方法”
- 用java实现的快速排序
- POJ 2388(中位数)
- Qt two ways write Debug() into file
- 根文件系统的挂载过程
- QT openGL 编程 笔记
- 尼玛的百度空间 害我要把文章都转移
- android 获取应用证书及签名信息
- 一个网卡绑定多个IP地址
- JSF+Spring integation
- Makefile 编写规则
- ShellExecute用法-弹出ie窗口用