[Lazarus] Unpack of PHP
David Knaack
davidknaack at gmail.com
Mon Feb 4 16:19:27 CET 2013
I may not understand the scope of your question, but could you use the swap
function?
http://www.freepascal.org/docs-html/rtl/system/swap.html
Like so (edited in email, not compile checked):
function ReadMWord(AStream: TStream): Word;
var
MW: Word
begin
AStream.Read(MW, SizeOf(Word));
Result := Swap(MW);
end;
On Mon, Feb 4, 2013 at 9:13 AM, silvioprog <silvioprog at gmail.com> wrote:
> 2013/2/4 silvioprog <silvioprog at gmail.com>
>
>> 2013/2/4 leledumbo <leledumbo_cool at yahoo.co.id>
>>
>>> > ps. I tried the Unpack function of FPC, but I don't know how to use it.
>>>
>>> Unpack() is for unpacking previously Pack()-ed data
>>>
>>
>> So, I'm trying to improve the PowerPDF to support PNG images, but I dont
>> know how to convert ASCII to Integer.
>>
>
> Solved:
>
> function ReadMWord(AStream: TStream): Word;
> type
> TMotorolaWord = record
> case Byte of
> 0: (Value: Word);
> 1: (Byte1, Byte2: Byte);
> end;
> var
> MW: TMotorolaWord;
> begin
> AStream.Read(MW.Byte2, SizeOf(Byte));
> AStream.Read(MW.Byte1, SizeOf(Byte));
> Result := MW.Value;
> end;
>
> :)
>
> --
> Silvio Clécio
> My public projects - github.com/silvioprog
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130204/62c1961e/attachment-0003.html>
More information about the Lazarus
mailing list