FileProcessing培训课件.pptVIP

  • 4
  • 0
  • 约7.42千字
  • 约 41页
  • 2019-05-25 发布于湖北
  • 举报
Fig17_04.cpp (1 of 2) 创建ofstream对象,打开文件 Overloaded operator! will return true if the file did not open successfully 重载operator void * ,遇到文件结束符EOF时(Ctrl+Z) ,返回一个空指针。 使用“”向文件中写入数据 ofstream 的析构函数被自动调用,隐式地关闭文件 Topics 17.1 Introduction 17.2 The Data Hierarchy 17.3 Files and Streams 17.4 Creating a Sequential File 17.5 Reading Data from a Sequential File 17.6 Input/Output of Objects 17.5 Reading Data from a Sequential File 创建 ifstream 对象 ifstream构造函数 A filename A file-open mode ios::in – 缺省模式,只能从文件读取数据,最小权限原则 例:ifstream inClientFile( clients.dat, ios::in ); 对于已经存在的ifstream对象,使用成员函数打开文件 例: ifstream

文档评论(0)

1亿VIP精品文档

相关文档