[Lazarus] Copy buffer of PWord to TMemoryStream

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Mar 24 19:24:26 CET 2013


On Sun, 24 Mar 2013 19:21:49 +0100
Sven Barth <pascaldragon at googlemail.com> wrote:

>[...]
> >> Hi, I'm copying a buffer of PWord to a TMemoryStream using this code:
> >>    inc(lTmpBuff, 1);
> >>    inc(I, 1);
> >
> > What about:
> >
> >     inc(lTmpBuff, SizeOf(PWord));
> >     inc(I, SizeOf(PWord));
> 
> If lTmpBuff is declared as PWord then "Inc" already increases in 
> multiplies of "SizeOf(PWord)".

I guess, you mean multiples of SizeOf(Word).


> Regarding lBufSize it will be important to know whether the C code 
> returns the size in elements or in byte.


Mattias




More information about the Lazarus mailing list