第6章 第8题 读取文件内容
来源:互联网 发布:身份证合成软件 编辑:程序博客网 时间:2024/05/21 15:06
#include<iostream>#include<fstream>#include <cstdlib>using namespace std;int main(){ char ch; int sum = 0; ifstream inFile; inFile.open("C:\\Users\\Administrator\\Desktop\\abc.txt"); //自己定义吧 if (!inFile.is_open()) { cout << "Could not open the file \n"; cout << "program terminating.\n"; exit(EXIT_FAILURE); } inFile >> ch; while (inFile.good()) { ++sum; inFile >> ch; }// if (inFile.eof)// cout << "End of file reached \n"; if (inFile.fail()) cout << "Inpue terminated by data mismatch.\n"; else cout << "Input terminated for unkonwn reason.\n"; cout << "总共有" << sum << "个字符在这个文件中。" << endl; return 0;}
阅读全文
0 0
- 第6章 第8题 读取文件内容
- Python跳过第一行读取文件内容
- Python 跳过第一行读取文件内容。
- MOOC清华《程序设计基础》第8章第2题:从文件读取二进制、按位异或
- c# 读取excel文件第1个表的内容
- python跳过第一行快速读取文件内容
- Python3跳过第一行快速读取文件内容
- 地第6周-项目五-多文件读取
- 第17周项目6-文件读取成绩进行处理
- UE 打开 class 文件,第一行内容
- 往文件第一行插入内容
- c# 读取ini文件第一行数据
- python 读取文件跳过第一行
- VB第8章 文件
- 第13章上课内容
- JAVA读取文件,初学~练习(第一种:字节读取)
- 第1章 第8题
- 第3章 第8题
- git
- 你不知道的JS-读书笔记(四)--混合对象类
- oracle中sql语句查询优化(六)
- mysql实现类似oracle merge into功能
- 评“没有目标的前进不如后退”
- 第6章 第8题 读取文件内容
- 高版本CAD画直线时,点击F8正交卡死解决方法
- java连接mysql
- 你不知道的JS-读书笔记(五)--原型[Prototype]
- 使用wkhtmltopdf将网页转换为PDF时echarts图表线条不完整
- 安卓控件工具类
- poj1724——ROADS
- SourceTree 免登录跳过初始设置
- oracle中sql语句查询优化(七)