RAD Studio VCL Reference
TReader.ReadChar Method

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

function ReadChar: Char;
__fastcall Char ReadChar();

ReadChar is a helper method used by other reader methods to read a tagged character value at the current reader Position. ReadChar first checks the value type (TValueType) by calling the ReadValue method. If the item is a vaString, ReadString checks the length. If the length indicates that the value is a char, it calls Read and returns the character. Otherwise a EReadError exception is raised.

Note: If the tagged data is a string with length = 1, it is char compatible. 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.


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!