C++
MZZ骏马
这个作者很懒,什么都没留下…
展开
-
CMAKE
CMake是一种跨平台编译工具原创 2023-01-30 15:28:29 · 683 阅读 · 0 评论 -
sqlite删除之前的数据
delete from GpsData WHERE CreateTime BETWEEN '2017-01-01 00:00:00' AND datetime('now','localtime','-1 day');测试:SELECT datetime('now','localtime','-1 hours');SELECT date('now','-1 day'); SELECT datetime('now','localtime');翻译 2022-05-12 10:34:17 · 825 阅读 · 0 评论 -
C++ 读取和存储图片文件二进制方式
// readpic.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <fstream> // ifstream, ifstream::inusing namespace std;int main(){ FILE* fp; // 1. 打开图片文件 // 评论区的 @霍鑫网络 帮忙发现一个隐藏的bug,在此表示感谢,已经修正 ifstream is("C:/abc/ttt.jpg", ifstream::in | ios.原创 2021-05-10 17:39:45 · 2897 阅读 · 0 评论 -
mysql触发器
-- ------------------------------ Table structure for `t_card`-- ----------------------------DROP TABLE IF EXISTS `t_card`;CREATE TABLE `t_card` ( `cardId` varchar(255) NOT NULL, `password` char(6) NOT NULL, `balance` int(11) NOT NULL, `open_d.翻译 2021-03-18 10:09:52 · 67 阅读 · 0 评论 -
Qt5读写串口
/******************************************************************************* * All rights reserved, Copyright (C) wtzhu * ----------------------------------------------------------------------------- * [File Name]: widget.h * [Description]: .原创 2021-03-17 14:42:18 · 253 阅读 · 0 评论 -
Mysql 只包留表中最新的十条数据
DELETE tb FROM cleanwarm_project_equipment_test AS tb,(SELECT equip_id FROM cleanwarm_project_equipment_test ORDER BY equip_id desc LIMIT 10,1) AS tmpWHERE tb.equip_id<tmp.equip_id说明 先查出最新的十条的 主键值(equip_id 主键值是 递增的整形)SELECT equip_id FROM...原创 2021-02-02 10:25:39 · 403 阅读 · 0 评论 -
C语言操作sqlite数据库
//#include "initqtouchvar.h"#include <math.h>#include <stdio.h>#include <stdarg.h>#include <time.h>#include <stdio.h>#include "sqlite3.h"#include "script.h"#define MAX_LINE 1024int callback(void *data, int.原创 2020-12-23 16:16:02 · 628 阅读 · 0 评论 -
IEC104发送序号和接受序号理解
超时的定义参数 默认值 备注 选择值t0 30s 连接建立的超时t1 15s 发送或测试APDU的超时t2 10s 无数据报文t2t3 20s 长期空闲t3 >t1状态下发送测试帧的超时所有超时值的最大范围: 1 到255s, 精确到1s。当报文接收方收到发送方的I格式报文后,如果没有I格式报文需要发送给对方,可以向对方发送S格式报文以对所接收到的报文进行确认;为了防止I格式报文在传送过程中丢失或重复传送...转载 2020-11-10 14:43:26 · 4148 阅读 · 0 评论 -
C获取windows的cpu序号和mac
// getmac.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <winsock2.h>#include <stdio.h> #include <stdlib.h>#include <string.h>#include <httpext.h> #include <windef.h>.翻译 2020-10-09 17:34:52 · 357 阅读 · 0 评论 -
QT信号槽
转自:http://www.cppblog.com/lovecpp666/articles/169108.htmlSignalsandSlotsinDepth(1) 信号和槽是Qt编程的一个重要部分。这个机制可以在对象之间彼此并不了解的情况下将它们的行为联系起来。 槽和普通的c++成员函数很像。它们可以是虚函数(virtual),也可被重载(overload),可以是公有的(public),保护的(protective),也可是私有的(private),它们可以像任何c+...转载 2020-07-18 08:51:26 · 539 阅读 · 0 评论 -
Linux下测试snmp
#include <iostream>#include <snmp_pp/snmp_pp.h>#define SYSDESCR "1.3.6.1.2.1.1.1.0" //ObjectID for system descriptor #define SYSOBJECTID "1.3.6.1.2.1.1.2.0" //ObjectID for system object ID #define SYSCONTACT .翻译 2020-06-09 16:35:06 · 1425 阅读 · 2 评论 -
VS2012打印Qdebug的信息设置方法
在“系统 ” “子系统” 里设置改成上图即可,运行时候会出现黑窗口原创 2020-01-21 10:41:30 · 252 阅读 · 0 评论 -
C++ ftp
#include <afxinet.h>bool main(){ BOOL dRes,pRes; HINTERNET hInternet; HINTERNET hConnect; hInternet = InternetOpen("A3GS Sample", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL...原创 2020-01-07 09:58:50 · 338 阅读 · 0 评论 -
一个类停停另一个类里的timer
QCtDrive *ctApp = NULL; ctApp = (QCtDrive*)qApp; if(nMeterIndex >= domparser.dataPackge.iMeterNum){ nMeterIndex = 0; cSendType = FINISH; ctApp->stopRealDataT...原创 2019-12-23 17:15:09 · 208 阅读 · 0 评论 -
认识数据库事务作用
start TRANSACTION; 开启事务DELETE from realsaveROLLBACK //回滚事务 就会将删除的数据恢复出来原创 2019-01-11 14:31:34 · 218 阅读 · 0 评论 -
C++ 获取CMD的输出结果
C++ 调用cmd的ping命令并获取结果 FILE *file; char ptr[1024] = {0}; char cmd[1024] = {0}; strcat(ptr, "ping www.baidu.com"); if ((file = _popen(ptr, "r")) != NULL) { whil...翻译 2019-01-11 14:50:40 · 4907 阅读 · 0 评论 -
C++ UDP
#include "stdafx.h"#include<stdio.h>#include<tchar.h>#include <iostream>#include <WinSock2.h>#include <Windows.h>using namespace std; //UDP#pragma comment(lib,...翻译 2019-08-05 14:57:45 · 283 阅读 · 0 评论 -
C操作串口(windows下)
#include "script.h"#include <stdio.h>HANDLE hCom;int readMax(){FILE *fp = NULL;char buff[255];fp = fopen("maxvarindex", "r");if (fp==NULL)printf("error!");fscanf(fp, "%s",...原创 2019-08-19 16:21:55 · 459 阅读 · 0 评论 -
ubuntu下C 语言连接mysql数据库
#include <stdio.h>#include <mysql/mysql.h>#define DB_HOST "127.0.0.1" // Database Host: 默认为 127.0.0.1 即localhost#define DB_USER "root" // 用户名,要确保对数据库有权限#define DB_PASS "root" // 密码#d...原创 2019-09-18 14:44:26 · 118 阅读 · 0 评论 -
C在ubuntu下连接和插入mysql数据库
#include <stdio.h>#include <mysql/mysql.h>#include <time.h>#define DB_HOST "127.0.0.1" // Database Host: 默认为 127.0.0.1 即localhost#define DB_USER "root" // 用户名,要确保对数据库有权限#define...原创 2019-09-19 10:09:34 · 212 阅读 · 0 评论 -
QT socket清空缓存区
笨方法:readAll西门子读(port102)03 00 00 16 11 E0 00 00 00 01 00 C1 02 01 00 C2 02 01 02 C0 01 09 (22)---0203 00 00 16 11 E0 00 00 00 01 00 C1 02 01 00 C2 02 01 01 C0 01 09 (22)----01...原创 2019-09-21 14:49:33 · 4956 阅读 · 0 评论 -
C++ 多客户端(server)
// moresocketserver.cpp : Defines the entry point for the console application.//#pragma once#include "stdafx.h"#include <stdio.h>#include <winsock.h>#include<vector>#inclu...翻译 2019-09-21 16:49:08 · 574 阅读 · 0 评论 -
协议61850学习
https://libiec61850.com/libiec61850/documentation/iec-61850-client-tutorial/(学习网站)从站读取数据MmsValue* dataSetValue123= IedConnection_readObject(con, &error, "simpleIOGenericIO/GGIO1.AnIn2.mag.f",...原创 2019-09-26 15:29:48 · 2462 阅读 · 1 评论 -
C 语言char * 截掉一部分
C 语言将char * 截掉后面一部分 直接 将那一位赋值 \0即可char * memberRef;memberRef[slen+2] = '\0';char* TagName=(char*)malloc(sizeof(char)*29);memcpy(TagName, memberRef, sizeof(char)*29);char *s=".mag.f\0"; //第...原创 2019-09-27 11:54:17 · 2719 阅读 · 0 评论 -
C语言 char *的截取 和拼接
例如 char * st="sdfd111111";将st更改为 sdfd2345;char* TagName=(char*)malloc(sizeof(char)*30);memcpy(TagName, memberRef, 29);//截取前29位 memberRef也是char * 类型TagName[29]='\0';//结束符 手动补一个结束符char *s=".m...原创 2019-09-27 16:48:16 · 11970 阅读 · 0 评论 -
C++ 写通讯协议细节
#include "stdafx.h"#include<string.h>struct tagPOINT1 { unsigned char x; unsigned char y;};struct tagPOINT1 p1;int main(int argc, char* argv[]){ unsigned char xxx[10]; ...原创 2018-07-17 16:58:14 · 2552 阅读 · 0 评论