用法和含义,在看了几位大牛的博文后,进行整理和总结:
这里主要是讨论
fstream
的内容:
[java]
view plaincopyprint?
1.
#include <fstream>
2.
ofstream //
文件写操作
内存写入存储设备
3.
ifstream //
文件读操作,存储设备读区到内存中
4.
fstream //
读写操作,对打开的文件可进行读写操作
1.
打开文件
在
fstream
类中,
成员函数
open
()
实现打开文件的操作,
从而将数据流和文件进行关联,
通过
ofstream,ifstream,fstream
对象进行对文件的读写操作
函数:
open
()
[cpp]
view plaincopyprint?
1.
<span style="font-family: Times New Roman; font-size: 16px;">
2.
public member function
3.
4.
void open ( const
char
* filename,
5.
ios_base::openmode mode = ios_base::in | ios_base::out );
6.
7.
void open(const
wchar_t
*_Filename,
8.
ios_base::openmode mode= ios_base::in | ios_base::out,
9.
int
prot = ios_base::_Openprot)
;
10.
11.
</span>