Internet Direct (Indy)
Home
PreviousUpNext
BytesToCardinal Function

Converts a TIdByte value to the ordinal datatype.

Pascal
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. 
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.