hmmm....just in playing, I found that if I go

  BlockRead(fFile, aNameArray[0], LengthNameField); 

its fine.....shruge


Jeremy

-----Original Message-----
From: "vss" <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Wed, 23 Oct 2002 10:04:12 +1300
Subject: [DUG]:  setlength strangeness - maybe

> Hi All.
> 
> I am having to read some info from a binary file.
> It caters for variable length fields by having one field that tells you
> the length of the next field.
> 
> i.e. LengthOfName = 11
>      in this case I read the next 11 bytes.
> 
> I thought I would use SetLength for a dynamic array so it knew how much
> to blockRead in.
> 
> i.e.
>    SetLength(oNameArray, LengthOfName);
> 
> BUT when I do this, and I look at oNameArray after its been read in,
> its 
> all #0 's, and its NOT 11 in size...its like 40 or more (or less)
> if I declare oNameArray : array[0..10] of char;  its fine.
> 
> Whats the story here? anyone know?
> 
> Thanks. Jeremy
> 
> -----------------------------------------------------------------------
> ----
>     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"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

---------------------------------------------------------------------------
    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"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to