60 IO流类库(二)
来源:互联网 发布:超人幻想 知乎 编辑:程序博客网 时间:2024/06/03 13:22
文件流
ofstream,由ostream派生而来,用于写文件
ifstream,由istream派生而来,用于读文件
fstream,由iostream派生而来,用于读写文件
#include <cassert>#include<iostream>#include <fstream>using namespace std;int main(void){ ofstream fout; fout.open("test.txt"); if (fout.is_open()) { cout << "succeed" << endl; } else { cout << "failed" << endl; } if (fout.good())//流状态是否正常 { cout << "succeed" << endl; } else { cout << "failed" << endl; } if (fout) { cout << "succeed" << endl; } else { cout << "failed" << endl; } if (!fout) { cout << "failed" << endl; } else { cout << "succeed" << endl; } assert(fout); fout.close(); return 0;}
文件打开模式
0 0
- 60 IO流类库(二)
- Java IO(二)
- IO(续二)
- IO流(二)
- IO学习(二)
- 说说IO--(二)
- IO总结(二)
- IO流(二)
- IO(二)
- Java--IO(二)
- IO流(二)
- io流(二)
- Java IO(二)
- IO学习(二)
- JAVA IO(二)
- IO(二)
- IO(二)
- 通用IO(二)
- GPU&VS2012&CUDA&matlab&Arrayfire杂记(二)——matlab
- 工作中遇到的问题
- Spring boot(4)-应用打包部署
- 关于百度地图API显示地区范围控制的问题
- 重建二叉树
- 60 IO流类库(二)
- linux ping不通外网unknown host xxxxx解决方法
- 查看MariaDB(MYSQL)数据库中用户及其拥有权限
- 在线数据迁移经验:如何为正在飞行的飞机更换引擎
- Tricks(二十一)—— 随机数
- Inventor API: 2017版本支持3D PDF
- SQL server 2005安装详记
- What kinds of iterators of C++'s copy function requires? What about reverse or unique?
- 关于使用iOS scrollView进行图片浏览的坐标问题