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();
基类
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();
相关文章推荐
- HDU 1286 找新朋友
- 在win32dll中使用CString的方法
- C语言数据类型(三)——变量与常量
- c++笔记 2
- 在源字符串中删除子字符串的函数
- C++ 11 : create all possible k combinations of n items
- 解决VS 2010/2012 C++ 生成的exe在非编译环境电脑中缺失dll的方法
- 将类封装成dll/lib的方法
- 编译器 内置宏 并且 支持不同c++标准,__cplusplus不同
- c++ static 变量的使用和用途
- 一起学习c++11——c++11中的新语法
- NwCreate之创建nwc文件
- keybd_event常量符号 含义
- 模拟键盘输入字符串的C++类
- 模拟键盘向当前光标处发送字符串
- 分割字符串
- 获取多个同名窗口的句柄
- 基于C语言sprintf函数的深入理解
- 提高项目31.4-读入一个C++程序,整理其格式,使其按规范排版
- 最小化所有窗口(模拟显示桌面)