Re: [Lazarus] Unpack of PHP

2013-02-04 Thread ik
On Mon, Feb 4, 2013 at 1:34 PM, silvioprog wrote: > Hello, > > In FPC, I'm trying to load a ASCII content and onvert it to integer, but, > without success. In PHP I do it easily. > > I send two files in attached: > > 1. php - demo in PHP working fine (the demo uses unpack function: > http://www.ph

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread leledumbo
> 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 -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Unpack-of-PHP-tp4029070p4029074.html Sent from the Free Pascal -

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread silvioprog
2013/2/4 ik > On Mon, Feb 4, 2013 at 1:34 PM, silvioprog wrote: > > Hello, > > > > In FPC, I'm trying to load a ASCII content and onvert it to integer, but, > > without success. In PHP I do it easily. > > > > I send two files in attached: > > > > 1. php - demo in PHP working fine (the demo uses

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread silvioprog
2013/2/4 leledumbo > > 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. -- Silvio Clécio My public pro

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread silvioprog
2013/2/4 silvioprog > ... but I dont know how to convert ASCII to Integer. > ... to convert ASCII pack to Integer. -- Silvio Clécio My public projects - github.com/silvioprog -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lis

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread silvioprog
2013/2/4 silvioprog > 2013/2/4 leledumbo > >> > 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

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread David Knaack
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))

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread silvioprog
2013/2/4 David Knaack > 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 >

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread Vincent Snijders
2013/2/4 silvioprog : > 2013/2/4 David Knaack >> >> 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: TStrea

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread silvioprog
2013/2/4 Vincent Snijders > 2013/2/4 silvioprog : > > 2013/2/4 David Knaack > >> > >> 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 chec

Re: [Lazarus] Unpack of PHP

2013-02-04 Thread silvioprog
2013/2/4 silvioprog > 2013/2/4 Vincent Snijders > >> 2013/2/4 silvioprog : >> > 2013/2/4 David Knaack >> >> >> >> 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

Re: [Lazarus] Unpack of PHP

2013-02-06 Thread Marco van de Voort
On Mon, Feb 04, 2013 at 03:29:54PM -0200, silvioprog wrote: > Oops... And this is the full code: > > program project1; > > {$mode objfpc}{$H+} > > uses > Classes, > SysUtils; > > function ReadInt(AStream: TStream): Word; > begin > Result := 0; > AStream.Read(Result, SizeOf(Word)

Re: [Lazarus] Unpack of PHP

2013-02-10 Thread silvioprog
2013/2/6 Marco van de Voort [...] > That's so boring! In FPC 2.7.1 this should work: > > uses >Classes, >SysUtils, >StreamEx; > var >VFile: TFileStream; > begin >VFile := TFileStream.Create('data.ascii', fmOpenRead or > fmShareDenyWrite); >try > VFile.Seek(2, 0); >