[C] 复位错误标志 →→→→→进入此内容的聊天室

来自 , 2019-12-21, 写在 C, 查看 107 次.
URL http://www.code666.cn/view/05a70454
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.    FILE *fp;
  6.    char ch;
  7.  
  8.    /* open a file for writing */
  9.    fp = fopen("DUMMY.FIL", "w");
  10.  
  11.    /* force an error condition by attempting to read */
  12.    ch = fgetc(fp);
  13.    printf("%c\n",ch);
  14.  
  15.    if (ferror(fp))
  16.    {
  17.       /* display an error message */
  18.       printf("Error reading from DUMMY.FIL\n");
  19.  
  20.       /* reset the error and EOF indicators */
  21.       clearerr(fp);
  22.    }
  23.  
  24.    fclose(fp);
  25.    return 0;
  26. }

回复 "复位错误标志"

这儿你可以回复上面这条便签

captcha