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

ip38域名信息查询网站找做网站的客户

ip38域名信息查询网站,找做网站的客户,大丰做网站的公司,河北省建设执业资格注册中心网站声明#xff1a;我个人特别讨厌#xff1a;收费专栏、关注博主才可阅读等行为#xff0c;推崇知识自由分享#xff0c;推崇开源精神#xff0c;呼吁你一起加入#xff0c;大家共同成长进步#xff01; 在文件读写的时候#xff0c;一般需要借助fstream来进行文件操作我个人特别讨厌收费专栏、关注博主才可阅读等行为推崇知识自由分享推崇开源精神呼吁你一起加入大家共同成长进步 在文件读写的时候一般需要借助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} }代码分析 seekg()用来设置stream的文件指针位置如in.seekg(14)就是将文件指针设置到14位置处相对begin位置这里相当于in.seekg(14, ios::beg)但是对于in.seekg(ios::end)却截然不同如stream3输出为2这是因为enum seekdir {beg, cur, end}所以当使用ios::cur和ios::end且只有一个参数的时候会将ios::cur隐式转换为1ios::end隐式转换为2所以stream3输出2stream12输出1这告诉我们当使用beg, cur, end为了避免错误请使用两个参数如in.seekg(0,ios::end)代替in.seekg(ios::end)tellg()没啥好说的就是返回文件流指针所在位置 声明我个人特别讨厌收费专栏、关注博主才可阅读等行为推崇知识自由分享推崇开源精神呼吁你一起加入大家共同成长进步
http://www.hkea.cn/news/14413114/

相关文章:

  • dw做aspx网站如何做产品的网络推广
  • 域名估价网站wordpress 媒体
  • 怎么做二维码让别人扫码进入网站装修公司最怕三种人
  • 网站改版的方式大致为局网站建设管理整改情况
  • 鹤壁做网站公司国外免费ip地址
  • 推广网站2024如皋建设医院网站
  • 天河区门户网站教育专栏天元建设集团有限公司王士坤
  • 百度搜索什么关键词能搜到网站网站资讯创作
  • 最有效的网站推广公司杭州专业网站营销
  • 贵州建设监理网站培训通知栏营销型网站建设的特点表现
  • 绍兴做网站的公司电子商务网站建设ppt模板下载
  • 怎样查到一些做品牌包的网站网站备案一天通过
  • 蓝色系的网站优秀的企业网站
  • 福州网站建设效果营销型网站建设实战
  • 唐山网站建设找煌途微信小程序制作文档
  • 2023免费网站推广沈阳做机床的公司网站
  • 如何看网站做没做推广wordpress 本地 搭建
  • 学校英文版网站建设方案ios wordpress使用
  • 建设银行网站查询网站专业优化公司
  • 网站的360度全景图片怎么做关键词优化哪家好
  • 网站外连移动建站平台
  • 合肥建站公司哪益阳网络营销
  • 网站数据库是干什么的网站设计与建设第一章
  • 广东万高建设网站免费建站免费网站
  • 优惠券怎做网站wordpress自动采集源码
  • 做网站编程语言用软件做的网站权限管理
  • 贵州网站开发流程北京app开发制作
  • 做网站是不是就能上传东西网页动效 wordpress
  • 国外网站推广服务空间设计网站
  • 宁波网站制作哪家全面腾讯域名购买