Writing complex records to file

Posted by DrSobhani on Stack Overflow See other posts from Stack Overflow or by DrSobhani
Published on 2010-12-26T09:40:16Z Indexed on 2010/12/26 9:54 UTC
Read the original article Hit count: 186

Filed under:
|
|
|
|

Hi I have defined some records in my project which may be consisted of other records and also dynamic arrays of normal data types and other records , it is n example of a record type

  Type1=record
    x:integer;
  end;
  Type2=record
    Y:array of X;
    str:string;
  end;

When I tried to save one of variables of these records type to file with blockwrite function like this :

var
  Temp1:Type2;
  begin
    setlength(temp1.y,100);
    blockwrite(MyFile,Temp1,sizeOf(Temp1);

it just wrote as much as the size of pure record is ,but temp1 has a dynmic arrays which is resized , Could someone please tell me how I can write a complex record to a file , I mean something like what is used in VB6 . Thanks

© Stack Overflow or respective owner

Related posts about arrays

Related posts about delphi