理工《C_C++程序设计教程》(第4版)课件第7章 文件.pptVIP

  • 6
  • 0
  • 约8.66千字
  • 约 41页
  • 2023-07-12 发布于天津
  • 举报

理工《C_C++程序设计教程》(第4版)课件第7章 文件.ppt

* * * * * * * * 实验题目 在文件夹中有一个data.dat文件,文件存入的内容如下: Octobe27,1891:Philip Downing is an American inventor.One that day,people atart to use his letterboxes.He makes the street letterbox better.He gives it a cover so the letterts are safe from the rain an the people. Today people still 实验题目 use this kind of lettersbox. 编写程序,读出data.dat文件的内容,并显示在屏幕上,同时把这些内容写入另一个文件 data.out中,检查写入是否正确。 知识点:文件的基本操作 feof(),fputc(),fgetc() 函数的使用 解题思路 用while循环语句判断是否读到文件末尾。用fgetc()函数读数据,然后分别用fputc()和putc()函数将数据写到文件和屏幕上。 知识回顾 请同学们编写程序,用字符型变量ch依次遍历字符串中每一个字符,并显示在屏幕上。 运行结果如下 小结 fopen(), fclose()函数的使用。 fe

文档评论(0)

1亿VIP精品文档

相关文档