Hi Luke,
I assume you've found that Peter Hyde's solution works?
As to the reason, I think it's because the first argument to WriteBuffer()
is an untyped const argument:
procedure TStream.WriteBuffer(const Buffer; Count: Longint);
I'm pretty sure untyped parameters are implemented as untyped pointers, so
you must pass an addressable data object (lvalue) for an untyped parameter,
ie no numerals, untyped numeric constants or pointers. A string variable is
a pointer, so you need to dereference the string to get the expected
result. Either of the following should work:
> Stream.WriteBuffer(AString[1], Length(AString));
> Stream.WriteBuffer(Pointer(AString)^, Length(AString));
Paul.
At 07:08 30/04/01 , you wrote:
>I can't explain this. I have a function which takes a stream and returns a
>hash of it. I wrote a wrapper that takes a string and passes it to the hash
>function as a stream. It looks like this:
>
----------------------------------------------------------
Paul Spain, Excellent Programming Company
mailto:[EMAIL PROTECTED]
----------------------------------------------------------
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"