[Lazarus] Copy buffer of PWord to TMemoryStream
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun Mar 24 19:02:18 CET 2013
On Sun, 24 Mar 2013 14:51:26 -0300
Leonardo M. Ramé <l.rame at griensu.com> wrote:
> Hi, I'm copying a buffer of PWord to a TMemoryStream using this code:
>
> lTmpBuff := lBuffer;
> I := 0;
> while I < lBufSize do
> begin
> lStream.Write(lTmpBuff^, SizeOf(PWord));
> inc(lTmpBuff, 1);
> inc(I, 1);
> end;
>
> As you can see, on each iteration, one PWord is copied. What I would
> like to do, is to copy bigger blocks, for example:
>
> lStream.WriteBuffer(lTmpBuff^, lBufSize);
lStream.WriteBuffer(lTmpBuff^, lBufSize*SizeOf(Word));
>[...]
Mattias
More information about the Lazarus
mailing list