Mike,

Ooops. You're right of course - I meant to say Chr().

Thanks,
Darren 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Michal Wozniak
Sent: 24 April 2005 22:13
To: Borland's Delphi Discussion List
Subject: Re: Array of byte to string conversion

Dnia niedziela, 24 kwietnia 2005 14:02, Darren McBride napisał:
> Folks,
>
> How do I convert the following array to a string ? Does anyone have a 
> Hex conversion routine or a link they can point me to ?
>
> a1: array[1..13] of Byte =
> ($68,$74,$74,$2E,$76,$65,$72,$69,$6E,$74,$6F,$2E,$63);
> a2: array[1..13] of Byte =
> ($6F,$6D,$2F,$73,$74,$6F,$6D,$65,$72,$2E,$61,$73,$70);
>
> Do I have to convert the hex to decimal and then use the Ord function, 
> or is there a single function that will do the job ?

?? I don't think you quite understand, what's going on here.

In any programming language, whether you write a number as, say 255, or $FF
- it is completely irrelevant. Compiler understands both as a number.

The Ord function takes a Char and returns its byte value - and you want to
do the other way round, right?

Just use the Char function on each field of the array, like
YourCharVar:=Char(a1[3]);

Cheers
Mike



_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi




_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to