[Lazarus] Copy buffer of PWord to TMemoryStream
Leonardo M. Ramé
l.rame at griensu.com
Sun Mar 24 18:51:26 CET 2013
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);
But, if I do this, I get different results than using the former method.
Do you see what I'm doing wrong?.
BTW, the buffer is an Uint16 array generated by a C++ library, the array
contains images with 65535 levels of gray.
Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the Lazarus
mailing list