C++文件的写入和读取
来源:互联网 发布:香水小样 知乎 编辑:程序博客网 时间:2024/06/09 19:20
//文件保存自用
// Filestream.cpp : 定义控制台应用程序的入口点。
#include "stdafx.h"#include <iostream>
#include <fstream>
using namespace std;
int main()
{ //打开文件 写
ofstream ofs("a.txt", ios::out);
ofs << "this is out!" << endl;
//关闭文件
ofs.close();
//打开文件 读
ifstream off("a.txt", ios::in);
char buf[80];
//是否到文件尾
while (!off.eof()) {
off.getline(buf, 80);
cout << buf << endl;}
//关闭文件
off.close();
return 0;
}
阅读全文
0 0
- 文件的读取和写入
- ******************* 文件的写入和读取 *******************
- 文件的读取和写入
- 文件的读取和写入
- 文件的读取和写入
- C语言和C++的文件读取、写入函数
- 【C#】读取和写入本地txt文件
- C#_File文件读取和写入
- c#excel文件的读取与写入
- C#xml文件的读取写入
- 【C++】文件的读取与写入
- 【C#】关于文件的写入与读取
- 【C++】文件的读取与写入
- 文件读取和写入
- 文件读取和写入
- 文件读取和写入
- 读取和写入Windows的INI文件
- java 文件的读取和写入
- Unity Shader入门精要 学习笔记一
- Android触屏事件(一、事件分发)
- linux 中的outb outw inb inw
- 怎么将File转换为MultipartFile类型
- LP-PSOLA算法之(二) 语音变调
- C++文件的写入和读取
- spark1.6编译
- eclipse编写wordcount提交spark运行
- LeetCode | 27. Remove Element
- 让元素有效和无效
- EM算法在K-Means中的运用
- C#关键字之const详解
- boom! charles ios10.3 代理失败 SSLHandshake: Received fatal alert: unknown_ca
- ajax前后台交互实现省市区级联