随笔分类 -  C++

QT下连接MYSQL
摘要:需要先编译dll 文件,按网上的教程打开工程,编译后生成两个文件: qsqlmysql.dll 和 qsqlmysqld.dll 。前者是release版,后者是 debug版本,都需要放在 C:\Qt\Qt5.12.12\5.12.12\mingw73_64\plugins\sqldrivers 阅读全文
posted @ 2022-04-26 23:20 五星 阅读(212) 评论(0) 推荐(0)
WinForm 程序自动适应高DPI
摘要:在解决方案中添加文件 "应用程序清单文件", 加入如下小节: <application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/ 阅读全文
posted @ 2022-01-29 09:43 五星 阅读(877) 评论(0) 推荐(0)
浮点保留两位“有效数字”,而不是两位“小数”
摘要:double.parse(d.ToString("G2")) 阅读全文
posted @ 2019-11-12 10:14 五星 阅读(248) 评论(0) 推荐(0)
可空类型的装箱
摘要:int a=7;int? b=5;int? c=null; a is int、a is int?、b is int、b is int? 都为true。 c is int、c is int? 为false 可空类型装箱(box)后,其值为基础类型object obj1=a, obj2=b, obj3= 阅读全文
posted @ 2018-04-23 09:58 五星 阅读(122) 评论(0) 推荐(0)
QT 下 QUdpSocket 加入指定源组播(SSM)的方法
摘要:QT下的类 QUdpSocket 仅提供了加入组播的功能 joinMulticastGroup,却没有提供加入SSM的功能。分析了一下QUdpSocket的源码,发现joinMulticastGroup仅是socket函数 setsocketoption的一个简单封装,隐藏了不同系统下实现的不同。于 阅读全文
posted @ 2017-04-15 10:16 五星 阅读(9441) 评论(1) 推荐(0)
C++ 获取当前时间的两种方法(精确到毫秒)
摘要:1. boost 方法 2. 标准库方法 3. chrono 阅读全文
posted @ 2017-04-10 00:33 五星 阅读(13085) 评论(0) 推荐(0)
C++ 中几种格式化字符串的方法
摘要:C++ 中几种格式化字符串的方法 1. sprintfC语言中的用法 2. string 序列化include <sstream> std::ostringstream ostr; ostr << "result:"<< hex <<setprecision(3) << n1 << "+" << n 阅读全文
posted @ 2017-04-08 18:43 五星 阅读(2227) 评论(0) 推荐(0)
C++ 笔记
摘要:#include <boost/timer.hpp> #include <boost/tokenizer.hpp> #include <boost/format.hpp> #include <boost/any.hpp> #include <boost/lexical_cast.hpp> #incl 阅读全文
posted @ 2017-04-08 11:50 五星 阅读(174) 评论(0) 推荐(0)