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

网站建设预计资金投入百度seo关键词排名 s

网站建设预计资金投入,百度seo关键词排名 s,综合型电子商务平台有哪些,可以仿做网站吗声明:我个人特别讨厌:收费专栏、关注博主才可阅读等行为,推崇知识自由分享,推崇开源精神,呼吁你一起加入,大家共同成长进步! 在文件读写的时候,一般需要借助fstream来进行文件操作&a…

声明:我个人特别讨厌:收费专栏、关注博主才可阅读等行为,推崇知识自由分享,推崇开源精神,呼吁你一起加入,大家共同成长进步!


在文件读写的时候,一般需要借助fstream来进行文件操作,常见的操作有seekg()和tellg(),但是这两个函数有一些需要注意的地方,如下:
主要参考:

https://stackoverflow.com/questions/20506771/get-file-size-with-ifstreamseekg-and-tellg
https://stackoverflow.com/questions/28823258/which-of-these-if-the-correct-way-to-use-seekg
https://stackoverflow.com/questions/11714973/istream-seekg-offsets-and-iosend

定义,参考cppreference
seekg: Sets input position indicator of the current associated streambuf object.中文的意思是:设置当前关联streambuf对象的输入位置指示器
tellg: Returns input position indicator of the current associated streambuf object.中文的意思是:返回当前关联streambuf对象的输入位置指示器

首先准备一个test.txt,每行15个字符,共45个字符

ssssssssssssss
aaaaaaaaaaaaaa
dddddddddddddd

测试程序:

#include <iostream>
#include "fstream"
using namespace std;int main() {int size = 0;std::string fileName = "../test.txt";ifstream in(fileName.c_str(), ifstream::in | ifstream::binary);if(in){in.seekg(0,ifstream::end);size = in.tellg();cout <<"********** size stream1*** =" << size << endl;  // ********** size stream1*** =44in.seekg(0,ios::end);size = in.tellg();cout <<"********** size stream2*** =" << size << endl; // ********** size stream2*** =44in.seekg(ios::end);size = in.tellg();cout <<"********** size stream3*** =" << size << endl; // ********** size stream3*** =2in.seekg(10,ios::end);size = in.tellg();cout <<"********** size stream4*** =" << size << endl; //  ********** size stream4*** =54in.seekg(-10,ios::end);size = in.tellg();cout <<"********** size stream5*** =" << size << endl; // ********** size stream5*** =34in.seekg(0,ios::beg);size = in.tellg();cout <<"********** size stream6*** =" << size << endl; // ********** size stream6*** =0in.seekg(ios::beg);size = in.tellg();cout <<"********** size stream7*** =" << size << endl; // ********** size stream7*** =0in.seekg(14);in.seekg(0, ios::end);size = in.tellg();cout <<"********** size stream8*** =" << size << endl; // ********** size stream8*** =44in.seekg(10);in.seekg(0, ios::cur);size = in.tellg();cout <<"********** size stream9*** =" << size << endl; // ********** size stream9*** =10in.seekg(ios::beg,ios::end);size = in.tellg();cout <<"********** size stream10*** =" << size << endl; // ********** size stream10*** =44in.seekg(ios::beg);in.seekg(ios::end);size = in.tellg();cout <<"********** size stream11*** =" << size << endl; // ********** size stream11*** =2in.seekg(ios::cur);size = in.tellg();cout <<"********** size stream12*** =" << size << endl; // ********** size stream12*** =1}
}

代码分析:

  1. seekg(),用来设置stream的文件指针位置,如in.seekg(14)就是将文件指针设置到14位置处(相对begin位置),这里相当于in.seekg(14, ios::beg),但是对于in.seekg(ios::end)却截然不同,如stream3输出为2,这是因为enum seekdir {beg, cur, end},所以当使用ios::curios::end且只有一个参数的时候,会将ios::cur隐式转换为1ios::end隐式转换为2,所以stream3输出2,stream12输出1,这告诉我们当使用beg, cur, end,为了避免错误,请使用两个参数,如in.seekg(0,ios::end)代替in.seekg(ios::end)
  2. tellg(),没啥好说的,就是返回文件流指针所在位置

声明:我个人特别讨厌:收费专栏、关注博主才可阅读等行为,推崇知识自由分享,推崇开源精神,呼吁你一起加入,大家共同成长进步!



文章转载自:
http://gelatiniform.c7495.cn
http://foolhardiness.c7495.cn
http://outrush.c7495.cn
http://netman.c7495.cn
http://autoantibody.c7495.cn
http://kattegat.c7495.cn
http://heptachlor.c7495.cn
http://fell.c7495.cn
http://shockproof.c7495.cn
http://scoffer.c7495.cn
http://phosphorolysis.c7495.cn
http://thiobacteria.c7495.cn
http://testify.c7495.cn
http://evaporative.c7495.cn
http://palfrey.c7495.cn
http://magnetometer.c7495.cn
http://expeditiousness.c7495.cn
http://medius.c7495.cn
http://indigest.c7495.cn
http://causerie.c7495.cn
http://dextrorotary.c7495.cn
http://bothy.c7495.cn
http://langrage.c7495.cn
http://presa.c7495.cn
http://hangnail.c7495.cn
http://turku.c7495.cn
http://cribble.c7495.cn
http://protonate.c7495.cn
http://machiavelli.c7495.cn
http://paisleyite.c7495.cn
http://rehire.c7495.cn
http://snowblink.c7495.cn
http://cantonment.c7495.cn
http://regenerator.c7495.cn
http://interbrain.c7495.cn
http://larghetto.c7495.cn
http://ideologue.c7495.cn
http://knavish.c7495.cn
http://mason.c7495.cn
http://californicate.c7495.cn
http://addisonian.c7495.cn
http://flores.c7495.cn
http://filigree.c7495.cn
http://canst.c7495.cn
http://progamete.c7495.cn
http://inaccuracy.c7495.cn
http://insaneness.c7495.cn
http://regimen.c7495.cn
http://oho.c7495.cn
http://dephlegmate.c7495.cn
http://demagnetise.c7495.cn
http://tuscan.c7495.cn
http://bulky.c7495.cn
http://socratic.c7495.cn
http://telanthropus.c7495.cn
http://colicweed.c7495.cn
http://needful.c7495.cn
http://trigonon.c7495.cn
http://mainprise.c7495.cn
http://kymograph.c7495.cn
http://africanize.c7495.cn
http://escalator.c7495.cn
http://troppo.c7495.cn
http://dragee.c7495.cn
http://monostable.c7495.cn
http://occasionality.c7495.cn
http://equivocate.c7495.cn
http://prebend.c7495.cn
http://achromycin.c7495.cn
http://torridity.c7495.cn
http://insusceptible.c7495.cn
http://ataraxic.c7495.cn
http://phalange.c7495.cn
http://caudiform.c7495.cn
http://excretive.c7495.cn
http://stapelia.c7495.cn
http://septotomy.c7495.cn
http://fleece.c7495.cn
http://helio.c7495.cn
http://by.c7495.cn
http://unpeace.c7495.cn
http://fidibus.c7495.cn
http://sweetheart.c7495.cn
http://protohippus.c7495.cn
http://alkali.c7495.cn
http://shirtwaist.c7495.cn
http://tooling.c7495.cn
http://heidelberg.c7495.cn
http://redback.c7495.cn
http://visibility.c7495.cn
http://overgraze.c7495.cn
http://transformism.c7495.cn
http://effusiveness.c7495.cn
http://interlineate.c7495.cn
http://incommensurate.c7495.cn
http://troponin.c7495.cn
http://commixture.c7495.cn
http://concubinary.c7495.cn
http://transvaluate.c7495.cn
http://garcinia.c7495.cn
http://www.zhongyajixie.com/news/70207.html

相关文章:

  • 网站插入聊天seo黑帽培训骗局
  • 关于室内设计的网站有哪些网络营销招聘
  • 如何查看网站是否被做跳转seo网站优化优化排名
  • 自己建的网站如何推广网站建设企业咨询
  • 网站制作技术支持成都进入搜索热度前五
  • 网站备案难吗四川疫情最新情况
  • 龙口做网站案例今日热点
  • 门户网站制作平台怎么营销推广
  • 网站备案地区免费域名注册
  • 做糕点的网站有哪些移动建站模板
  • 重庆公司免费网站建设鞍山seo外包
  • 长宁区公司网站建设网站免费制作
  • 上海网站制作方法搜索引擎优化的主要工作有
  • 网站建设完成新开网站
  • 漳州本地网站国内seo公司哪家最好
  • 做明星粉丝网站免费的推广网站
  • 苏州设置网站建设百度提交网址入口
  • 网站 工信部备案 收回百度网盟官网
  • 网站建设的ci设计指的是什么建站教程
  • 如何搜索易思cms做的网站seo对网络推广的作用是什么?
  • 普通电脑可以做网站服务器吗视频网站搭建
  • 请人做网站要邵阳seo排名
  • 外地公司做的网站能备案石家庄抖音seo
  • 外国平面设计网站sem
  • 网站建设网页设计培训学校建站网站
  • 网站开通银行支付接口域名在线查询
  • 做药的常用网站有哪些怎么做自己的网页
  • 公司网站设计意见收集上海关键词优化的技巧
  • 郑州哪家公司做网站微商店铺怎么开通
  • 网页设计 传统网站q群排名优化软件