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

# TStream.Write

Writes data from the stream to the buffer and returns the number of bytes written.

## Declaration

`public function TStream.Write(`
`const Buffer;`
`Count: LongInt`
`):LongInt; virtual; abstract;`

## Description

Write attempts to write Count bytes from Buffer to the stream. It returns the actual number of bytes written to the stream.

This method should be used when the number of bytes that should be written is not determined. If a specific number of bytes should be written, use TSTream.WriteBuffer instead.

Write is an abstract method that is overridden by descendent classes to do the actual writinging.

## Errors

Descendent classes that do not allow writing to the stream may raise an exception when Write is used.

## See also

TStream.Read |  | Reads data from the stream to a buffer and returns the number of bytes read.
TStream.WriteBuffer |  | Writes data from the stream to the buffer