[Lazarus] reading a little endian long.
Dave Coventry
dgcoventry at gmail.com
Sun Dec 21 07:06:49 CET 2008
Great, thanks Andrew.
2008/12/21 Andrew Haines <andrewd207 at aol.com>:
> Dave Coventry wrote:
>> If I Blockread(F,buffer,4) with buffer being an array of byte, Is
>> there a routine in fpc/lazarus which will revers the bytes for me?
>>
>> This is what I want:
>> longv:=buffer[0];
>> longv+=buffer[1] shl 8;
>> longv+=buffer[2] shl 16;
>> longv+=buffer[3] shl 24;
>>
>> Is there a function which does this for me?
>> _______________________________________________
>>
> Yes. See LEtoN, BEtoN, NtoLE and NtoBE.
>
> BlockRead(F, FooLongInt, 4);
>
> FooLongInt := LEtoN(FooLongInt);
>
> Regards,
>
> Andrew
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
More information about the Lazarus
mailing list