NAME

fdclose, fdflush, fdgetc, fdgets, fdread, fdseek, fdtell, fdwrite - limited input buffering

SYNOPSIS

#include "stock.h"

int fdgetc(int fd)
int fdgets(int fd, char *buf, int maxbytes)
int fdread(int fd, char *buf, int nbytes)
off_t fdseek(int fd, off_t offset, int whence)
int fdtell(int fd)
int fdclose(int fd)

int fdwrite(int fd, char *buf, int nbytes)
int fdflush(int fd)

DESCRIPTION

These routines furnish some of the functionality of the standard UNIX buffered file routines. On a mac, however, they work better (that is, they work) on growing files, such as diskserver(1) sees.

fdgetc returns a single character, or -1 if an error or end of file is found.

fdgets returns a maximum of maxbytes-1 of a single line of input into buf. The trailing linefeed is eliminated and the string is terminated with a null character. Any characters beyond maxbytes-1 in a line are lost.

fdread attempts to return the specified number of bytes, and returns a count of the actual number returned, or -1 if an error occurred.

fdseek positions the file at the specified offset.

fdtell returns the current position of the file.

fdclose closes an input stream.

fdwrite copies nbytes bytes from buf to a buffer associated with the specified file descriptor fd.

fdflush flushes the internal buffer, writing it to disk.

RETURN VALUES

fdgets returns the number of bytes read, -2 at eof, or -1 if the internal input buffer becomes outrageously large (>1 Mbyte).

fdread returns the number of bytes read, or -1 if an error occurs.

fdseek returns the result from lseek(2).

fdtell returns the current position in the file (may be different from tell(fd)).

fdclose returns the result from close(2), normally zero.

fdwrite returns the number of bytes copied.

fdflush returns the number of bytes written or an error code from write(2).

LIBRARY

$(STOCKLIBS)

ATTRIBUTES

MT-Safe

SEE ALSO

fgets(3)

AUTHOR

Daniel Quinlan

Table of Contents
Antelope Release 4.8 Darwin 8.7.0 2006-09-20
Boulder Real Time Technologies, Inc For more information, contact support@brtt.com