QT之write and read
来源:互联网 发布:java filereader 指针 编辑:程序博客网 时间:2024/05/17 06:14
#include <QDebug>
#include <QTextStream>
#include <QString>
#include <QFile>
void Write(QString Filename) //写入TXT文件
{
QFile mFile(Filename);
if(!mFile.open(QFile::WriteOnly | QFile::Text))
{
qDebug()<<"could not open file for writing";
return;
}
QTextStream out(&mFile);
out<<"hello world";
mFile.flush();
mFile.close();
}
void Read(QString Filename) //从TXT文件读取
{
QFile mFile(Filename);
if(!mFile.open(QFile::ReadOnly | QFile::Text))
{
qDebug()<<"could not open file for reading";
return;
}
QTextStream in(&mFile);
QString mText=in.readAll();
qDebug()<<mText;
mFile.close();
}
0 0
- QT之write and read
- Qt Write and Read XML File 读写XML文件
- Read and Write XML
- Read and Write Excel
- file read and write
- write and read
- read and write files
- Python read and write
- read and write binary xml
- Read and write bytes data
- Read and Write File Code
- read and write '.bmp' file
- IO read and write. demo
- plist --- 's read and write
- [C++]C++小笔记之Simple File read and write-- ofstream and ifstream
- socket编程之read/write
- Read and Write XLS in Java - JXLS
- [zz] Read and write a properties file
- iOS开发-微信右侧弹出视图实现
- leetcode刷题 总结 记录 备忘 64
- HDU 3529 Bomberman - Just Search!
- HTML—看完轻松入门
- Service
- QT之write and read
- uva12563 Jin Ge Jin Qu hao
- 美团Android自动化之旅—生成渠道包
- POJ 1084 Square Destroyer
- OBIEE分析开发-并集不同列设置不同数据格式
- 解决8080端口被占,Tomcat无法正常启动
- 关联源码
- 百度地图用城市名称切换城市更新地图
- 【读书笔记】iOS-UIWindow-WindowLevel