1.其他小内容合集
来源:互联网 发布:hadoop2.6.0源码下载 编辑:程序博客网 时间:2024/05/17 03:38
使用控制台打开程式,需自动运行,可以使用计时器
runtimer = new QTimer();
connect(runtimer, SIGNAL(timeout()), this, SLOT(StartTest()));
runtimer->start();
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Little-Endian&Big-Endian
不同的CPU有不同的字节序类型,这些字节序是指整数在内存中保存的顺序。
最常见的有两种:
1. Little-endian:将低序字节存储在起始地址(低位编址)
2. Big-endian:将高序字节存储在起始地址(高位编址)
例子1:在内存中双字0x01020304(DWORD)的存储方式。
内存地址 4000 4001 4002 4003
注:每个地址存1个字节,每个字有4个字节。2位16进制数是1个字节(0xFF=11111111)。
例子2:如果我们将0x1234abcd写入到以0x0000开始的内存中,则结果为
big-endian little-endian
0x0000 0x12 0xcd
0x0001 0x23 0xab
0x0002 0xab 0x34
0x0003 0xcd 0x12
x86系列的CPU都是little-endian的字节序
+++++++++++++++++++++++++++++++++++++++++++++++++++++
限制lineEdit内容为数字
QRegExp regx("[1-9][0-9]+$"); set lineedit only number
QValidator *validator = new QRegExpValidator(regx, ui.lineEdit);
ui.lineEdit->setValidator(validator);
QValidator *validator = new QRegExpValidator(regx, ui.lineEdit);
ui.lineEdit->setValidator(validator);
消除空格
EnVersion.replace(QRegExp("[\\s]+"), "");
+++++++++++++++++++++++++++++++++++++++++++++++++++++
二进制读取文件,读取后的内容可通过USB指令写入,虽然USB指令时使用unsigned char,但只要二进制格式不变既没问题
ifstream iFile
iFile.open(BIN.toStdString(), ios_base::binary);
if (!iFile)
{
pLog->OutLog("BIN File does not exits.");
return FALSE;
}
iFile.seekg(0, ios::end);
long len = iFile.tellg();
char *buf = new char[len];
iFile.seekg(0, ios::beg);//set to ios::beg , or will not read
iFile.read(buf, len*sizeof(char));
iFile.close();
if (!iFile)
{
pLog->OutLog("BIN File does not exits.");
return FALSE;
}
iFile.seekg(0, ios::end);
long len = iFile.tellg();
char *buf = new char[len];
iFile.seekg(0, ios::beg);//set to ios::beg , or will not read
iFile.read(buf, len*sizeof(char));
iFile.close();
0 0
- 1.其他小内容合集
- 2.其他小内容合集
- 视野@其他 @ 合集
- 小问题合集
- 小tip合集
- 小问题合集
- 小程序合集
- 小程序合集
- 小程序合集
- 小程序合集
- 【Effective Java】最佳实践 其他合集
- Js小技巧合集
- 电脑小技巧合集
- cocos2dx 小问题合集
- jQuery 小技巧合集
- Ubuntu 小问题合集
- 小程序合集2
- 其他没有转载的内容.各种小知识点
- Unicode介绍
- 深入理解Java:注解(Annotation)--注解处理器
- tftp服务器搭建
- java io的相对路径和绝对路径
- windows下修改host不生效的解决方法
- 1.其他小内容合集
- 解决Win7 svn图标不显示
- string字符截取
- C语言实现链表节点的插入和删除
- 获取终端的相关信息
- JSESSIONID、cookie与SESSION的区别和联系 同名JSESSIONID处理
- 不定长内存池之apr_pool
- 基于 CXF 的 restful 风格的webservice 实现
- Android wpa_supplicant源码分析---nl80211内核通信Generic Netlink