基本介紹
- 外文名:ferror
- 屬性:函式名
- 例如: putc.getc.fread.fwrite等
- 用 法:int ferror
用 法: int ferror(FILE *stream);
程式例:
#include<stdio.h>intmain(void){FILE*stream;/*openafileforwriting*/stream=fopen("DUMMY.FIL","w");/*forceanerrorconditionbyattemptingtoread*/(void)getc(stream);if(ferror(stream))/*testforanerroronthestream*/{/*displayanerrormessage*/printf("ErrorreadingfromDUMMY.FIL\n");/*resettheerrorandEOFindicators*/clearerr(stream);}fclose(stream);return0;}