To tylko jedna z 2 stron tej notatki. Zaloguj się aby zobaczyć ten dokument.
Zobacz
całą notatkę
Ferror Tests for an error on a stream. int ferror( FILE * stream ); • 0 means: no error has occurred on stream • Otherwise: a nonzero value • The ferror routine tests for a reading or writing error on the file associated with stream • If an error has occurred, the error indicator for the stream remains set until: - the stream is closed - or rewound - or until clearerr is called #include int main(void) { FILE *stream; /* open a file for writing */ stream = fopen("Test.txt", "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 Test.txt\n"); /* reset the error and EOF indicators */ clearerr(stream); } fclose(stream); return 0; }
... zobacz całą notatkę
Komentarze użytkowników (0)