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

# TStream.ReadAnsiString

Read an ansistring from the stream and return its value.

## Declaration

`public function TStream.ReadAnsiString: String;`

## Description

ReadAnsiString reads an ansistring from the stream and returns its value. This is a utility function which simply calls the read function several times. The Ansistring should be stored as 4 bytes (a DWord) representing the length of the string, and then the string value itself. The WriteAnsiString function writes an ansistring in such a format.

## Errors

If the AnsiString cannot be read, a EStreamError exception will be raised.

## See also

TStream.Read |  | Reads data from the stream to a buffer and returns the number of bytes read.
TStream.WriteAnsiString |  | Write an ansistring to the stream.
TStream.ReadByte |  | Read a byte from the stream and return its value.
TStream.ReadWord |  | Read a word from the stream and return its value.
TStream.ReadDWord |  | Read a DWord from the stream and return its value.