牛骨文教育服务平台(让学习变的简单)
博文笔记

C++中的流对象

创建时间:2016-07-13 投稿人: 浏览次数:738
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();


声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。