*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: fio | Section: 3 | Source: UNIX v10 | File: fio.3
FIO(3) Library Functions Manual FIO(3) NAME Finit, Frdline, Fgetc, Fread, Fseek, Fundo, Fputc, Fprint, Fwrite, Fflush, Ftie, Fclose, Fexit - fast buffered input/output SYNOPSIS #include <fio.h> void Finit(fd, buf) char *buf; int Fclose(fd); int Fprint(fildes, format [, arg ...]) int fildes; char *format; char *Frdline(fd) int FIOLINELEN(fd) long FIOSEEK(fd) int Fgetc(fd) void Fundo(fd) long Fseek(fd, offset, ptr) long offset; int Fputc(fd, c) long Fread(fd, addr, nbytes) char *addr; long nbytes; long Fwrite(fd, addr, nbytes) char *addr; long nbytes; int Fflush(fd) void Ftie(ifd, ofd) Fexit(type) DESCRIPTION These routines provide buffered I/O, faster than, and incompatible with stdio(3). The routines can be called in any order. I/O on different file descriptors is independent. Finit initializes a buffer (whose type is Fbuffer) associated with the file descriptor fd. Any buffered input associated with fd will be lost. The buffer can be supplied by the user (it should be at least sizeof(Fbuffer) bytes) or if buf is (char *)0, Finit will use mal- loc(3). Finit must be called after a stretch of non-fio activity, such as close or lseek(2), between fio calls on the same file descriptor number; it is unnecessary, but harmless, before the first fio activity on a given file descriptor number. Fclose flushes the buffer for fd, frees the buffer if it was allocated by Finit, and then closes fd. Frdline reads a line from the file associated with the file descriptor fd. The newline at the end of the line is replaced by a 0 byte. Frd- line returns a pointer to the start of the line or on end of file or read error. The macro FIOLINELEN returns the length (not including the 0 byte) of the most recent line returned by Frdline. The value is un- defined after a call to any other fio routine. Fgetc returns the next character from the file descriptor fd, or a neg- ative value at end of file. Fread reads nbytes of data from the file descriptor fd into memory starting at addr. The number of bytes read is returned on success and a negative value is returned if a read error occurred. Fseek applies lseek(2) to fd taking buffering into account. It returns the new file offset. The macro FIOSEEK returns the file offset of the next character to be processed. Fundo makes the characters returned by the last call to Frdline or Fgetc available for reading again. There is only one level of undo. Fputc outputs the low order 8 bits of c on the file associated with file descriptor fd. If this causes a write (see read(2)) to occur and there is an error, a negative value is returned. Otherwise, zero is returned. Fprint is a buffered interface to print(3). If this causes a write to occur and there is an error, a negative value is returned. Otherwise, the number of chars output is returned. Fwrite outputs nbytes bytes of data starting at addr to the file asso- ciated with file descriptor fd. If this causes a write to occur and there is an error, a negative value is returned. Otherwise, the number of bytes written is returned. Fflush causes any buffered output associated with fd to be written; it must precede a call of close on fd. The return is as for Fputc. Ftie links together two file descriptors such that any fio-initiated read(2) on ifd causes a Fflush of ofd (if it has been initialized). It is appropriate for most programs used as filters to do Ftie(0,1). The tie may be broken by Ftie(ifd, -1). Fexit is used to clean up all fio buffers. If type is zero, the buffers are Fflushed, otherwise they are Fclosed. Fexit(0) is automat- ically called at exit(3). SEE ALSO open(2), print(3), stdio(3) DIAGNOSTICS Fio routines that return integers yield -1 if fd is not the descriptor of an open file or if the operation is inapplicable to fd. BUGS Frdline deletes characters from lines longer than 4095 characters, ig- nores characters after the last newline in a file, and will read past and end-of-file indication on a stream. The data returned by Frdline may be overwritten by calls to any other fio routine. Fgetc is much slower than access through a pointer returned by Frdline. There is no scanf(3) analogue. FIO(3)

Navigation Options