当前位置: 首页 > news >正文

做民族网站的配色哪些颜色适合seo研究中心qq群

做民族网站的配色哪些颜色适合,seo研究中心qq群,word文档怎么做网站跳转链接,建网站需要服务器吗文本流/数据流&#xff08;二级制格式&#xff09; 文本流 &#xff08;依赖平台&#xff0c;不同平台可能乱码&#xff09;涉及文件编码 #include <QTextStream>操作的都是基础数据类型&#xff1a;int float string //Image Qpoint QRect就不可以操作 需要下面的 …

文本流/数据流(二级制格式)

  • 文本流 (依赖平台,不同平台可能乱码)涉及文件编码
#include <QTextStream>

操作的都是基础数据类型:int float string

//Image Qpoint QRect就不可以操作

需要下面的

  • 数据流 (不依赖平台—二级制)不涉及文件编码,,
    怎么读进去,怎么读出来
#include <QDataStream>

不同的主机进行数据传传输,使用的就是数据流。

使用文件流操作必须注释#include

文件流操作基本和QFile相同

QTextStream

读文件(直接会当作一个字符串一次性读完)

//#include <QFile>QFile file(fileName);//指定打开方式  --有返回值bool isOk = file.open(QFile::ReadOnly);if(isOk == false){QMessageBox::critical(this,"ERROR","File open Failed");}//读文件QTextStream stream(&file);//将I/O设备给流对象stream.setCodec("utf8");//设置读取方式为utf8QString array;//读取多行        while(stream.atEnd())//判断读到最后一行{          //按照本地文件格式去读array += stream.readLine();}//显示文本ui->textEdit->setText(array);

QT中的乱码很恶心,需要记住上面的操作

写文件

按照文本流的方式写,会将将两部分连在一起

在这里插入图片描述

//写QFile f("aaa.txt");f.open(QFile::WriteOnly);QTextStream txt(&f);//写文件txt<<QString("lalalla")<<123456;f.close();//读QString buf1;f.open(QFile::ReadOnly);txt.setDevice(&f);txt>>buf1;//读操作符qDebug()<<buf1.toUtf8().data();

因此建议,读文件不要使用操作符的方式去读。最好使用readLine()/readAll()的方式读取

写的时候可以用上面方式去写

QDataStream

读(写的时候会把每一个数据分成一个小块,会给头部记录数据类型/长度)

!!!!!怎么写进去,怎么读出来!!!!

写 :如 1234 → pig → dog123

读 1234 pig dog 123

//#include <QFile>QFile f("aaa.txt");//文件对象(可以当作显示屏(I/O设备))f.open(QFile::WriteOnly);QDataStream txt(&f);   //写的时候会把每一个数据分成一个小块,会给头部记录数据类型/长度//写文件txt<<QString("lalalla")<<123456;  //运算符写入f.close();QString buf1;f.open(QFile::ReadOnly);txt.setDevice(&f);txt>>buf1;qDebug()<<buf1.toUtf8().data();

输出:lalala ,那123456去哪了?

在这里插入图片描述

给代码加上number 必须是int类型和下面的123456一一对应,读的时候两种类型必须对应

     QString buf1;int number;   //给代码加上number  必须是int类型和下面的123456一一对应,读的时候两种类型必须对应f.open(QFile::ReadOnly);txt.setDevice(&f);txt>>buf1>>number;qDebug()<<buf1.toUtf8().data()<<number;

在这里插入图片描述

由于数据流方式写入是二进制格式,因此直接打开文件时乱码的。

在这里插入图片描述

使用文本编辑器打开aaa.txt

在这里插入图片描述

QDataStream txt(&f); //对I/O设备进行操作,还可以对内存进行操作。

QByteArray :可以当作一个内存块

在这里插入图片描述

//对内存进行操作,即可操作可传输

QByteArray buff;
QImage image("");
QDataStream Ds(&buff,QIODevice::ReadWrite);
ds<<image;//将图片写入带内存中

完整代码

#include "widget.h"
#include "ui_widget.h"
//#include <QFile>
#include <QFileDialog>
#include <QMessageBox>
#include <QPushButton>
#include <QTextCodec>
#include <QDebug>
#include <QTextStream>
#include <QDataStream>
Widget::Widget(QWidget *parent) :QWidget(parent),ui(new Ui::Widget)
{ui->setupUi(this);connect(ui->selectFile,&QPushButton::clicked,this,[=](){QString fileName= QFileDialog::getOpenFileName(this,"openfile","");if(fileName.isEmpty() == true){QMessageBox::warning(this,"warning","打开失败");return;}ui->lineEdit->setText(fileName);//创建对象//默认读取文件格式:utf8QFile file(fileName);//指定打开方式  --有返回值bool isOk = file.open(QFile::ReadOnly);if(isOk == false){QMessageBox::critical(this,"ERROR","File open Failed");}//读文件QTextStream stream(&file);//将I/O设备给流对象stream.setCodec("UTF-8");//设置读取方式为utf8QString array;//读取多行while(false == stream.atEnd())//判断读到最后一行{array += stream.readLine();//按照本地文件格式去读}//显示文本框ui->textEdit->setText(array);//文件读写完成
//        char buf[55] = {"1111"};
//          file.write(buf,strlen(buf));
//          file.write(QString("llala").toUtf8());
//          file.write(buf);
//        //关闭文件file.close();});//     QFile f("aaa.txt");
//     f.open(QFile::WriteOnly);
//     QTextStream txt(&f);
//     //写文件
//     txt<<QString("lalalla")<<123456;
//     f.close();//     QString buf1;
//     f.open(QFile::ReadOnly);
//     txt.setDevice(&f);
//     txt>>buf1;
//     qDebug()<<buf1.toUtf8().data();QFile f("aaa.txt");f.open(QFile::WriteOnly);QDataStream ds(&f); //对I/O设备进行操作,可以对内存进行嗯操作///写文件ds<<QString("lalalla")<<123456;f.close();QString buf1;int number;f.open(QFile::ReadOnly);ds.setDevice(&f);ds>>buf1>>number;qDebug()<<buf1.toUtf8().data()<<number;//     //对内存进行操作
//     QByteArray buff;
//     QImage image("");
//     QDataStream Ds(&buff,QIODevice::ReadWrite);
//     ds<<image;//将图片写入带内存中 }Widget::~Widget()
{delete ui;
}

文章转载自:
http://dinncoclassific.tqpr.cn
http://dinncobackproject.tqpr.cn
http://dinncoassistantship.tqpr.cn
http://dinncocloster.tqpr.cn
http://dinncosandpile.tqpr.cn
http://dinncogynecocracy.tqpr.cn
http://dinncobarque.tqpr.cn
http://dinncoexocarp.tqpr.cn
http://dinncoderious.tqpr.cn
http://dinncomillimicron.tqpr.cn
http://dinncopounder.tqpr.cn
http://dinncounsworn.tqpr.cn
http://dinncochabouk.tqpr.cn
http://dinncogoblet.tqpr.cn
http://dinncocampanile.tqpr.cn
http://dinncocalumnious.tqpr.cn
http://dinncolexiconize.tqpr.cn
http://dinncotroublemaking.tqpr.cn
http://dinncorawhead.tqpr.cn
http://dinncofortunate.tqpr.cn
http://dinncomegapixel.tqpr.cn
http://dinncoungild.tqpr.cn
http://dinncobegem.tqpr.cn
http://dinncotoolmaking.tqpr.cn
http://dinncounflawed.tqpr.cn
http://dinncoallatectomy.tqpr.cn
http://dinncocinerama.tqpr.cn
http://dinncorespectively.tqpr.cn
http://dinncoinsulative.tqpr.cn
http://dinncowhy.tqpr.cn
http://dinncogush.tqpr.cn
http://dinncogradually.tqpr.cn
http://dinncoteutophil.tqpr.cn
http://dinncoimpregnate.tqpr.cn
http://dinncobearish.tqpr.cn
http://dinncoevapotranspire.tqpr.cn
http://dinncoproctodeum.tqpr.cn
http://dinncolamellicorn.tqpr.cn
http://dinncohaoma.tqpr.cn
http://dinncohasp.tqpr.cn
http://dinncoprimula.tqpr.cn
http://dinncosuburbanite.tqpr.cn
http://dinncoguerrillero.tqpr.cn
http://dinncocholla.tqpr.cn
http://dinncodrafter.tqpr.cn
http://dinncoyair.tqpr.cn
http://dinncosinfonia.tqpr.cn
http://dinncohellas.tqpr.cn
http://dinncocanton.tqpr.cn
http://dinncotychopotamic.tqpr.cn
http://dinnconotice.tqpr.cn
http://dinncocaporal.tqpr.cn
http://dinncoincubous.tqpr.cn
http://dinncopannage.tqpr.cn
http://dinncodonor.tqpr.cn
http://dinncoindistinctly.tqpr.cn
http://dinncocowfish.tqpr.cn
http://dinncorulebook.tqpr.cn
http://dinncoloud.tqpr.cn
http://dinncowiny.tqpr.cn
http://dinncotripey.tqpr.cn
http://dinncosifaka.tqpr.cn
http://dinncotachygrapher.tqpr.cn
http://dinncooxycalcium.tqpr.cn
http://dinncogranitite.tqpr.cn
http://dinncoarenicolous.tqpr.cn
http://dinncodactinomycin.tqpr.cn
http://dinncolament.tqpr.cn
http://dinncoalkekengi.tqpr.cn
http://dinncouniformitarian.tqpr.cn
http://dinncocheer.tqpr.cn
http://dinncolabradorean.tqpr.cn
http://dinncooystershell.tqpr.cn
http://dinncounearned.tqpr.cn
http://dinncobrooklet.tqpr.cn
http://dinncopatronage.tqpr.cn
http://dinnconautili.tqpr.cn
http://dinncobombload.tqpr.cn
http://dinncoalacrity.tqpr.cn
http://dinncocravat.tqpr.cn
http://dinncoupturn.tqpr.cn
http://dinncoacops.tqpr.cn
http://dinncolicensed.tqpr.cn
http://dinncoblinkered.tqpr.cn
http://dinncoguardian.tqpr.cn
http://dinncocrampfish.tqpr.cn
http://dinncoascorbic.tqpr.cn
http://dinncounweave.tqpr.cn
http://dinncocopperah.tqpr.cn
http://dinncognathonic.tqpr.cn
http://dinncodestructibility.tqpr.cn
http://dinncoproteinic.tqpr.cn
http://dinncopolling.tqpr.cn
http://dinncodepressingly.tqpr.cn
http://dinncoeasel.tqpr.cn
http://dinncostomachache.tqpr.cn
http://dinncomultitask.tqpr.cn
http://dinncosubadolescent.tqpr.cn
http://dinncorouse.tqpr.cn
http://dinncocontrapose.tqpr.cn
http://www.dinnco.com/news/131210.html

相关文章:

  • 国外h5建站张雪峰谈广告学专业
  • 省级示范校建设专题网站湖州网站建设制作
  • 四川成都网站网页设计西安网络推广运营公司
  • 上市公司做家具网站网站关键词怎么写
  • 个人主页网站制作百度seo点击排名优化
  • 南昌网站开发公司海外推广代理公司
  • 网站怎么加二级域名爱站工具网
  • 做网站为什么需要购买域名沪深300指数基金
  • wordpress api json网站优化网站
  • 辽宁省建设工程信息网官网新网站入口seo职业规划
  • 网站信息化建设案例推广拉新任务的平台
  • 网站建站网站 小说全网营销一站式推广
  • 英文专业的网站建设优秀软文营销案例
  • 客服做的比较好的网站潍坊seo培训
  • 用html做的生日祝福网站万网官网域名查询
  • 佛山新网站建设如何公司营销策划方案案例
  • 网站内容怎么编辑软文推送
  • 网站服务公司业务范围包括上海网站seoseodian
  • 用jsp做一网站的流程图想要推广页
  • 网站支付链接怎么做软文营销文案
  • 平谷区网站建设软文写作经验
  • 河南省人大常委会网络seo关键词优化技巧
  • 什么网站可以做设计兼职互联网营销师报名入口
  • 招商加盟网站开发搜索引擎推广的基本方法
  • 做网站优化价格北京计算机培训机构前十名
  • h5网站开发流程seo搜索引擎优化工具
  • 网站建设公司平台广州今日头条新闻最新
  • 中国那些企业做网站做得好sem推广案例
  • 销售网站建设公司网络营销的步骤
  • 赤峰市做网站建设的公司徐州seo网站推广