第十六周阅读程序-7
来源:互联网 发布:mmd舞蹈动作数据 编辑:程序博客网 时间:2024/04/30 10:28
/*copyright(c)2016.烟台大学计算机学院 * All rights reserved, * 文件名称:text.Cpp * 作者:刘涛 * 完成日期:2016年6月11日 * 版本号:vc++6.0 * 问题描述:阅读程序 */ #include<iostream>#include <fstream>using namespace std;const char * filename = "a.txt";int main (){ long l,m; ifstream file (filename, ios::in|ios::binary); l = file.tellg(); file.seekg (0, ios::end); m = file.tellg(); file.close(); cout << "size of " << filename; cout << " is " << (m-l) << " bytes.\n"; return 0;}
运行结果;
C++中seekg函数的功能是:设置输入文件流的文件流指针位置。第一个参数是指偏移的位置,第二个参量指新的文件流指针位置值;
tellg()用于输入流,返回流中指指针当前的位置。
程序作用就是检查a.txt中的字节数。
0 0
- 第十六周阅读程序-7
- 第十六周程序阅读(7)
- 第十六周 阅读程序
- 第十六周阅读程序
- 第十六周阅读程序
- 第十六周 阅读程序
- 第十六周 程序阅读
- 第十六周 程序阅读
- 第十六周--阅读程序
- 第十六周--阅读程序
- 第十六周--阅读程序
- 第十六周 阅读程序
- 第十六周--阅读程序
- 第十六周--阅读程序
- 第十六周--阅读程序
- 第十六周--阅读程序
- 第十六周--阅读程序
- 第十六周--阅读程序
- C# 使用Parallel并行开发Parallel.For、Parallel.Foreach实例
- 约束总结
- C++之虚函数
- 【Get深一度】高斯白噪声之——散粒噪声(shot noise )
- gulp教程之gulp中文API
- 第十六周阅读程序-7
- SAP中采购订单状态与MRP的关系
- PRO-2 Day1
- 政治哲学与幸福根基 (David Miller )
- PCI 总线及地址空间
- 解决eclipse字体太小问题
- asp.net:webconfig简单数据库配置
- leetcode Single Number III
- NodeJS优缺点及适用场景讨论