[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

    Read -- Read bytes of data from a file

    actualLength = Read( file, buffer, length )
    D0                   D1    D2      D3

    LONG Read(BPTR, void *, LONG)

    Data can be copied using a combination of Read() and Write().
    Read() reads bytes of information from an opened file (represented
    here by the argument 'file') into the buffer given. The argument
    'length' is the length of the buffer given.

    The value returned is the length of the information actually read.
    So, when 'actualLength' is greater than zero, the value of
    'actualLength' is the the number of characters read. Usually Read
    will try to fill up your buffer before returning. A value of zero
    means that end-of-file has been reached. Errors are indicated by a
    value of -1.

    Note: this is an unbuffered routine (the request is passed directly
    to the filesystem.)  Buffered I/O is more efficient for small
    reads and writes; see FGetC().

    file - BCPL pointer to a file handle
    buffer - pointer to buffer
    length - integer

    actualLength - integer

    Open(), Close(), Write(), Seek(), FGetC()

[Back to Amiga Developer Docs]