Chapter Contents

Previous

Next
ferror

ferror



Test Error Flag

Portability: ISO/ANSI C conforming, UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <stdio.h>

int ferror(FILE *f);


DESCRIPTION

ferror tests whether the error flag has been set for the FILE object addressed by f . This flag is set whenever an I/O function fails for any reason. The error flag for a file remains set after an error until it is cleared with clearerr .


RETURN VALUE

ferror returns 0 if the error flag is not set and a nonzero value if the error flag is set.


IMPLEMENTATION

ferror(f) (where f addresses a FILE object for a file closed by fclose ) is nonzero. Other implementations may return 0 if ferror is used on a closed file.


EXAMPLE

ferror is illustrated in the example for ftell .


RELATED FUNCTIONS

clearerr , clrerr , feof


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.