Try using StringVar[1] or PChar(StringVar)?
========================================================
Luke Pascoe Delphi Programmer
enSynergy Consulting LTD
[EMAIL PROTECTED] +64-9-3551593 fax +64-9-3551590
Level 4, 10-12 Federal St, Auckland, New Zealand
PO Box 32521, Devonport, Auckland 1330, New Zealand
================== I.H.T.F.P. ==========================
> -----Original Message-----
> From: Ross Levis [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 25 June 2001 2:01 p.m.
> To: Multiple recipients of list delphi
> Subject: [DUG]: Blockwrite strings
>
>
> Hello all.
>
> I'm self-teaching myself Delphi 5. I had Pascal experience
> almost 20 years
> ago at Uni and it's all coming back to me slowly. This is my
> first Windows
> development system. Previously using Dataflex for DOS (for
> the last 13
> years) which is similar to Pascal.
>
> Anyway, I'm writing a random file based utility which uses Blockread &
> Blockwrite. Can someone tell me why this code doesn't write anything
> useful:
>
> Stringvar := 'Hello World'; {defined as string}
> Blockwrite(outputfile,Stringvar,1); {outputfile has a record
> length of 2448}
>
> It just writes 2448 bytes of memory dump which I would expect
> if Stringvar
> was empty.
> I tried it with Stringvar defined as an array of char which
> works fine, but
> an array is too much work to fill each char position individually. The
> on-line help suggests the buffer parameter can be any
> variable type so why
> doesn't it work?
>
> Thanks,
> Ross.
> --------------------------------------------------------------
> -------------
> 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"
>
---------------------------------------------------------------------------
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"