C Now

Handle eof Function

Site Logo

Usage:

The eof function is used to test whether the file pointer is at the end of the file.

Prototype:

int eof (int Handle);

Argument:

Handle
Selector (file descriptor) of an open file.

Header Files:

io.h
(eof)
errno.h
(errno values)

Returns:

 0
File pointer is not at end of file.
 1
File pointer is at end of file. (Set before end of file has been passed.)

Side Effect:

errno
Iff the read fails, the global variable errno is set to error code
EBADF
Handle not open

Example:

#include <io.h> 
 .  .  .
  int       Account_Master;
  char      Buffer [100];
  int       Maximum;
  int       Actual;
    .  .  .
  Maximum = 100;
    .  .  .
  Account_Master = open ("accounts.dat", O_RDONLY);
    .  .  .
  while (!eof (Account_Master)) {
    Actual = read (Account_Master, Buffer, Maximum);
    .  .  .
  }

The io.h Header File Listing  The io.h Header File Listing
The Handle close Function  The Handle close Function
The Handle open Function  The Handle open Function
The Handle read Function  The Handle read Function
The Handle write Function  The Handle write Function
C Now Home  C Now Home
Include Files Index  Include Files Index
Header io.h Index  Header io.h Index
E-Mail
Valid HTML 4.01 Transitional Valid CSS! Site Logo

copyright 2001-2006, j.h.young, revised 2/13/06

The io.h Header File Listing / The Handle close Function / The Handle open Function / The Handle read Function / The Handle write Function /