Ross Levis asks:

> The on-line help suggests the buffer parameter can be any variable type
> so why doesn't it work?

BlockWrite is defined as follows:

  procedure BlockWrite(var f: File; var Buf; Count: Integer
    [; var AmtTransferred: Integer]);

and the key things is the var Buf; parameter. In Delphi land this is a
parameter of any type, but what is actually passed is a pointer to the
lvalue parameter. So if you use something like  a char, integer or double,
you will be passing a pointer to the location you are going to write from.

But because Delphi strings are dynamically allocated, passing a sreing must
be done carefully so as to pass a point to thew chacters you want to write,
and not a pointer to a pointer to the characters 8-)

So you must use Stringvar[1] as your parameter, which will actually pass
@Stringvar[1] to the routine and things will work. Just one of those areas
of Delphi that cause the brin some strain at times.

Cheers, Max.


---------------------------------------------------------------------------
    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"

Reply via email to