[DUG] HEX to decimal

Jeremy Coulter jscoulter at gmail.com
Fri Aug 5 09:32:42 NZST 2011


The data returned in SerialPortNG.ReadNextClusterAsString, is it a buch of
chars at a time, or just one at a time?
If its a bunch of them at a time, you will need to do a conversion one char
at at time in a loop.

i.e. for x:=0 to length(sRaw) do
       begin
          ivalue:= ORD(sRaw[x])) ;
       end;

something along those lines....I didnt write that in Delphi, I just did it
from memory but it should help a bit....I hope.

Jeremy

On Fri, Aug 5, 2011 at 8:43 AM, Steven Knight <Steven.Knight at ecan.govt.nz>wrote:

>  You might need to use the ORD function byte by byte****
>
> ** **
>
> Steven****
>
> ** **
>
> *From:* delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
> *On Behalf Of *Marshland Engineering
> *Sent:* Thursday, 4 August 2011 7:47 p.m.
> *To:* delphi at delphi.org.nz
> *Subject:* Re: [DUG] HEX to decimal****
>
> ** **
>
>  ****
>
> Been there done that ****
>
>  ****
>
> edit2.text := IntToStr(StrToInt('$' + sRaw));****
>
> Result      '[' is not a valid integer. ****
>
>  ****
>
>  ****
>
>  ****
>
>  ****
>
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the sender of the message.
>
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
>
> www.ecan.govt.nz
> **********************************************************************
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20110805/f90db7b8/attachment.html 


More information about the Delphi mailing list