fd_read

fd_read --  reads a buffer or string from a file identified by a file descriptor.

Syntax

fd_read (fd, buffer|string, length?, offset?)

		

Arguments

fd

A file descriptor as returned from fd_open.

buffer|string

A buffer or string to be read from the file.

length

An integer specifying the length of the buffer or string.

offset

An integer specifying the position in the file to begin reading the buffer or string.

Returns

The number of bytes actually read from the file, or -1 on failure and the errno is set.

Description

This function reads a buffer or string from the specified file.

When an error occurs, the following errnos are possible:

Example

    Gamma> x = fd_open("/fd/ser1",O_RDWR);
    4
    Gamma> fd_read(x,"hello\n");
    6
    Gamma> fd_close(x);
    t
    		

See Also

fd_close, fd_open, fd_read, ser_setup, Referencing Files

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.