feof, ferror, clearerr, or fileno Macro

Purpose

Checks the status of a stream.

Library

Standard C Library (libc.a)

Syntax

#include <stdio.h>

int feof ( Stream)
FILE *Stream;

int ferror (Stream)
FILE *Stream;
void clearerr (Stream)
FILE *Stream;
int fileno (Stream)
FILE *Stream;

Description

The feof macro inquires about the end-of-file character (EOF). If EOF has previously been detected reading the input stream specified by the Stream parameter, a nonzero value is returned. Otherwise, a value of 0 is returned.

The ferror macro inquires about input or output errors. If an I/O error has previously occurred when reading from or writing to the stream specified by the Stream parameter, a nonzero value is returned. Otherwise, a value of 0 is returned.

The clearerr macro inquires about the status of a stream. The clearerr macro resets the error indicator and the EOF indicator to a value of 0 for the stream specified by the Stream parameter.

The fileno macro inquires about the status of a stream. The fileno macro returns the integer file descriptor associated with the stream pointed to by the Stream parameter. Otherwise a value of -1 is returned.

Parameters

Item Description
Stream Specifies the input or output stream.