-
ferror
鎖定
- 外文名
- ferror
- 屬 性
- 函數名
- 例 如
- putc.getc.fread.fwrite等
- 用 法
- int ferror
用 法: int ferror(FILE *stream);
程序例:
#include<stdio.h> int main(void) { FILE* stream; /*open a file for writing*/ stream = fopen("DUMMY.FIL","w"); /*force an error condition by attempting to read*/ (void) getc(stream); if (ferror(stream))/*test for an error on the stream*/ { /*display an error message*/ printf("Error reading from DUMMY.FIL\n"); /*reset the error and EOFindicators*/ clearerr(stream); } fclose(stream); return 0; }