[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Objects' (#rtl)

# TBufStream.Read

Read data from the file to a buffer in memory.

## Declaration

Source position: objects.pp line 359

`procedure TBufStream.Read(`
`var Buf;`
`Count: LongInt`
`); virtual;`

## Description

If the Stream is open and the stream status is stOK then Read will read Count bytes from the stream and place them in Buf.

Read will first try to read the data from the stream's internal buffer. If insufficient data is available, the buffer will be filled before continuing to read. This process is repeated until all needed data has been read.

For an example, see TStream.Read.

## Errors

In case of an error, Status is set to StReadError, and ErrorInfo gets the OS specific error, or 0 when an attempt was made to read beyond the end of the stream.

## See also

TStream.Read |  | Read data from stream to buffer.
TBufStream.Write |  | Write data to the file from a buffer in memory.