System.Classes.TReader.ReadChar

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ReadChar: Char;

C++

System::WideChar __fastcall ReadChar(void);

Properties

Type Visibility Source Unit Parent
function public
System.Classes.pas
System.Classes.hpp
System.Classes TReader

Description

Reads and returns a character from the reader object's stream.

ReadChar is a helper method used by other reader methods to read a character at the current reader Position. ReadChar calls ReadValue to read the value-type indicator. If the value-type indicator is vaString, vaLString, vaWString, or vaUTF8String, then ReadChar calls Read to read a string of the indicated type. Then ReadChar checks that the string contains exactly one character (of the indicated type) and returns this character. Otherwise the EReadError exception is raised.

ReadChar advances the reader Position after the last byte it has read.

Note: ReadChar succeeds if the tagged data is a string with length = 1. If length > 1, it is an error, however, the rest of the string data must be read to keep the reader in a consistent state. Each action that processes tagged data must leave the reader Position at the start of the next unread tag.

See Also