当前位置:网站首页>QT memory mapping
QT memory mapping
2022-06-25 13:47:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Recently, when looking at the code, I found Qt Memory mapping for , I only know MFC There is a memory mapping mechanism , You can save time when reading big data files , original Qt There are corresponding mechanisms in , Its usage is simpler , Here is a small example to demonstrate its usage
#include <QtCore/QCoreApplication>
#include <QFile>
#include <QDebug>
#include <iostream>
#include <stdio.h>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QFile file("1.txt");
file.open(QIODevice::ReadWrite);
qDebug() << QStringLiteral(" Memory size :") << file.size();
uchar *fpr = file.map(0, file.size());
int i = 0;
int x1 = 0, x2 = 0, x3 = 0;
char *pEnd1 = NULL;
char *pEnd2 = NULL;
char *pEnd3 = (char *)fpr;
for (int i = 0 ; i < 3 ; ++i)
{
x1 = strtod(pEnd3, &pEnd1);
x2 = strtod(pEnd1, &pEnd2);
x3 = strtod(pEnd2, &pEnd3);
std::cout << x1 << "," << x2 << "," << x3 << "\n";
}
file.close();
return a.exec();
}Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/151691.html Link to the original text :https://javaforall.cn
边栏推荐
- 1024 hydrology
- Some knowledge about structure, enumeration and union
- Always maintain epidemic prevention and control and create a safe and stable social environment
- Discuz仿今日头条模板/Discuz新闻资讯商业版GBK模板
- Asp.net WebForm使用NPOI导出Excel
- Openstack learning notes -nova component insight
- 數據在內存中的存儲相關內容
- Application of tactile intelligent sharing-rk3568 in financial self-service terminal
- Kubernetes cluster construction of multiple ECS
- Regular match the phone number and replace the fourth to seventh digits of the phone number with****
猜你喜欢

Stockage des données en mémoire

[pit avoidance refers to "difficult"] antd cascader implements new customized functions

“移动云杯”算力网络应用创新大赛火热报名中!

leetcode:918. 环形子数组的最大和【逆向思维 + 最大子数组和】

Application of tactile intelligent sharing-rk3568 in financial self-service terminal

NR-ARFCN和信道栅格、同步栅格和GSCN

Rust, le meilleur choix pour un programmeur de démarrer une entreprise?

Storage related contents of data in memory

Mise en place d'un Cluster kubernets avec plusieurs serveurs Cloud

k线图24种经典图解(影线篇)
随机推荐
sql导入这样怎么解决
作为一名软件测试工程师你认为怎么样才能保证软件质量?
初始c语言的知识2.0
“移动云杯”算力网络应用创新大赛火热报名中!
Error1822 and error1824 are displayed in the database
How to determine if a web worker has been created or closed
Golang keyboard input statement scanln scanf code example
Using swiper to realize seamless rotation of multiple slides
Regular match the phone number and replace the fourth to seventh digits of the phone number with****
Kubernetes cluster construction of multiple ECS
The starting point for learning programming.
OpenStack学习笔记之-Nova组件深入了解
À propos du stockage des données en mémoire
Pointer, it has to say that the subject
Discuz仿今日头条模板/Discuz新闻资讯商业版GBK模板
Deep parsing and implementation of redis stream advanced message queue [10000 words]
权益NFT开创者Hash Eagle如何重新定义NFT,用权益赋能长续价值?
算力&NFT交易平台F3.xyz旗下独家权益NFT项目Hash Eagle将盛大发行
C # switch between Chinese and English input methods
历史上的今天:网易成立;首届消费电子展召开;世界上第一次网络直播