Topic Path: Symbol Reference > Functions > BytesToCardinal Function
ContentsIndexHome
PreviousUpNext
BytesToCardinal Function

Converts a TIdByte value to the ordinal datatype.

File
function BytesToCardinal(
    const AValue: TIdBytes; 
    const AIndex: Integer = 0
): Cardinal;
Parameters 
Description 
AValue 
Byte values to be converted.
 
AIndex 
Initial position in the array of bytes to use when converting to the ordinal data type. 

Cardinal - Ordinal value of the TIdByte argument.

BytesToCardinal is a utility function used to convert an array of byte values to the ordinal data type. 

AValue is an array of bytes representing the values to be converted to the ordinal data type. 

AIndex indicates the initial position in the array of bytes to use when converting byte values to the ordinal data type. 

Please note that AValue must have an allocated size large enough to represent the ordinal data type using the indicated offset into the array of bytes. When AValue is too small, an EAssertionFailed exception will be raised and the return value for the function is the cardinal value 0 (zero). 

 

For the .Net platform, the framework method System.BitConverter.ToUInt32 is used to prepare the return value for the function. 

 

For other platforms, the Move procedure from the Borland Runtime Library is used to prepare the return value for the function. 

Use one of the following utility functions to convert TIdByte values to another ordinal datatype: 

 

BytesToCardinal 
Exceptions 
Description 
EAssertionFailed 
Raised when the array bytes in AValue is too small to represent the ordinal data type using the specified offset in the array of bytes. 
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.