[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

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

Stream Specifies the input or output stream.

Related Information

The fopen, freopen, or fdopen (fopen, fopen64, freopen, freopen64 or fdopen Subroutine) subroutine, open (open, openx, open64, creat, or creat64 Subroutine) subroutine.

Input and Output Handling in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]