RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TEncoding.GetBytes Method (PChar, Integer, PByte, Integer)

Encodes a set of characters into a sequence of bytes.

Pascal
function GetBytes(Chars: PChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; virtual; abstract; overload;
function GetBytes(const Chars: TCharArray): TBytes; overload;
function GetBytes(const Chars: TCharArray; CharIndex: Integer; CharCount: Integer; var Bytes: TBytes; ByteIndex: Integer): Integer; overload;
function GetBytes(const S: string): TBytes; overload;
function GetBytes(const S: string; CharIndex: Integer; CharCount: Integer; var Bytes: TBytes; ByteIndex: Integer): Integer; overload;
C++
virtual __fastcall int GetBytes(const char * Chars, int CharCount, PByte Bytes, int ByteCount) = 0;
__fastcall TBytes GetBytes(const TCharArray Chars);
__fastcall int GetBytes(const TCharArray Chars, int CharIndex, int CharCount, TBytes Bytes, int ByteIndex);
__fastcall TBytes GetBytes(const AnsiString S);
__fastcall int GetBytes(const AnsiString S, int CharIndex, int CharCount, TBytes Bytes, int ByteIndex);

TEncoding.GetBytes encodes Chars parameter into a sequence of bytes. 

Chars can be a character array or a character pointer which will be encoded into a sequence of bytes. 

S is a string of type UnicodeString to be encoded into a sequence of bytes. 

The CharCount parameter specifies the number of characters to encode. 

Bytes specifies the location to write the sequence of bytes. 

ByteCount is the maximum number of bytes that can be written to the given location. 

The Return Value is the number of bytes actually encoded or the actual TBytes sequence of bytes. 

 

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