第6章 流 库.pptVIP

  • 4
  • 0
  • 约 53页
  • 2016-08-21 发布于河南
  • 举报
第6章 流 库

第6章 流 库 6.1 C++语言为何有自己的I/O系统 在C语言中,若要建立结构: struct my_struct { int count ; char s[80]; double balance; } cust; 没有办法扩展C语言的I/O得到形如 printf(“%my_struct”,cust); 的式子。因为printf只识别预定义类型,没有办法把其功能延伸到新的数据类型上。 6.2 C++语言流库的结构 C++流库是用继承方法建立起来的流库的输入输出类库,有两个平行的基类: streambuf 和ios. streambuf :strstreambuf,filebuf,conbuf ios:istream, ostream C++自动打开4个预定义的流 extern istream_withassign cin; extern ostream_withassign cout; extern ostream_withassign cerr; extern ostream_withassign clog; cin和cout可以重新定向 cerr和clog

文档评论(0)

1亿VIP精品文档

相关文档