您的位置:首页 > 编程语言 > C语言/C++

C++中的流对象

2016-07-13 23:10 645 查看
1.I/O类库中常用的流类:

基类

ios

istream
:ios

ostream
:ios

iostream
:istream,ostream

文件流

ifstream :istream

ofstream :ostream

fstream :iostream

字符流

istrstream

ostrstream

strstream

2.用到的头文件:

iostream 基本输入输出流

fstream 文件流使用

strstream 字符串流使用

stdiostream 混用c和c++中的I/O流使用

iomanip 格式化流使用

3.标准输出流:cout,cerr,clog

3.1。格式输出:可以使用流对象的成员函数来格式化

使用控制符:如dec,hex,setw,setionsflags(ios::fixed)

4.标准输入流cin,

cin.get,cin.getline

5.文件流:

文件流打开,

ofstrem outfile;

outfile.open("f1.dat",ios::out);

关闭流,outfile.close();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: