当前位置:网站首页>File operation of QT
File operation of QT
2022-07-28 08:29:00 【Happy Jiajia】
Qt File operation
void write(QString f)
{
QFile file(f);
if( file.open(QIODevice::WriteOnly | QIODevice::Text) )
{
file.write("D.T.Software\n");
file.write("Delphi Tang\n");
file.close();
}
}
void read(QString f)
{
QFile file(f);
if( file.open(QIODevice::ReadOnly | QIODevice::Text) )
{
QByteArray ba = file.readLine();
QString s(ba);
qDebug() << s;
file.close();
}
}
void info(QString f)
{
QFile file(f);
QFileInfo info(file);
qDebug() << info.exists();
qDebug() << info.isFile();
qDebug() << info.isReadable();
qDebug() << info.isWritable();
qDebug() << info.created();
qDebug() << info.lastRead();
qDebug() << info.lastModified();
qDebug() << info.path();
qDebug() << info.fileName();
qDebug() << info.suffix();
qDebug() << info.size();
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
write("C:/Users/hp/Desktop/test.txt");
read("C:/Users/hp/Desktop/test.txt");
info("C:/Users/hp/Desktop/test.txt");
return a.exec();
}
边栏推荐
- 我们如何在mysql中运行批处理模式?
- MPLS -- multi protocol label switching technology
- DCL singleton mode
- Record a MYCAT connection and solve the problems of communications link failure
- These mobile security browsers are more than a little easy to use
- awk从入门到入土(16)awk变量类型探讨--关于数字和string两种类型
- 豪华版h5俄罗斯方块小游戏源码
- QT uses semaphores to control threads (qsemaphore)
- pyspark更改列顺序存入iceberg数据库
- h5机甲射击类小游戏源码下载
猜你喜欢

protobuf 基本语法总结

What happens when you unplug the power? Gaussdb (for redis) dual life keeps you prepared

See how Google uses pre training weights in target detection tasks | CVPR 2022
![In the task manager, the CPU speed displayed is greater than its maximum speed [main frequency]](/img/90/a3f56ef8f08a8735febba16af227f9.png)
In the task manager, the CPU speed displayed is greater than its maximum speed [main frequency]
![Chapter 01 introduction of [notes of Huashu]](/img/11/cc405a730822305f02f05678f6a9d1.png)
Chapter 01 introduction of [notes of Huashu]

Deep browser rendering principles
![[Qt5] small software with 5 people randomly selected from the bid evaluation expert base](/img/ca/9f6bd6af45e2113c050edf3a65aaf2.png)
[Qt5] small software with 5 people randomly selected from the bid evaluation expert base

Recommend a fully open source, feature rich, beautiful interface mall system

【17】 Establish data path (upper): instruction + operation =cpu

Puzzle (004.3) pattern puzzle
随机推荐
Prescan quick start to proficient in lecture 17, speed curve editor
记录一次mycat连接Communications link failure问题解决
How to use QT help documents
The core packages and middleware required for golang development cover all areas of the project and are worth collecting
[book club issue 13] Chapter 1 multimedia processing tools ffmpeg tools
Mysql中有哪些不同的表格?
机械革命蛟龙p有线网卡驱动打不上
How to understand the adjective prefix of socket: "connection oriented" and "connectionless"
Is the salary of test / development programmers unbalanced? Busy life, all kinds of job hopping
[leetcode] 24. Exchange nodes in the linked list in pairs
js糖果消消乐小游戏源码
Freezing and thawing of pytoch
Mechanical revolution Jiaolong P wired network card driver can't play
js卡通英文字母打字小游戏源码
百度智能云九州区县大脑,描绘城乡新蓝图!
[environment configuration] ppyoole trains its own data set (for its own use)
Talk about row storage and column storage of database
Deluxe H5 Tetris game source code
Protobuf basic grammar summary
See how Google uses pre training weights in target detection tasks | CVPR 2022