filepointer.pptVIP

  • 7
  • 0
  • 约 18页
  • 2016-05-30 发布于天津
  • 举报
filepointer.ppt

Input/Ouput Chap 22 22.1 Streams Stream means any source of input or any destination for output. A file pointer is used to access a stream. FILE *fp1, *fp2; Standard streams Opening a File (22.2) Syntax: FILE *filePtr = fopen(fileName, mode); filePtr is a variable of a file pointer, a pointer to a FILE-structure object. mode: read (讀檔), write (寫檔), append (追加); text (文字檔), binary 檔. (See next page) Ex: FILE *fptr = fopen(mydata.txt, r); Opening a File Table of file open modes (開啟模式): Opening a File ASCII mode (純文字模式): fopen()預設是 ASCII 模式 讀入 DOS 換行符號 \r\n (\x0d0a) 時,會自動改成 \n 寫出 \n時也會改為 \r\n \0

文档评论(0)

1亿VIP精品文档

相关文档