1. 首页
  2. 数据库
  3. 其它
  4. C++中读取整个文件的方法

C++中读取整个文件的方法

上传者: 2020-12-30 14:09:01上传 PDF文件 23.24KB 热度 9次
方式一 #include "stdafx.h" #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { //写入文件 ofstream ofs; //提供写文件的功能 ofs.open("d:\com.txt",ios::trunc); //trunc打开文件时,清空已存在的文件流,若不存在此文件则先创建 int i; char a = 'a'; for(i = 1; i != 27; ++i) { if(i < 10
下载地址
用户评论