D2009 read a string in a record from a file of record

Giganews Newsgroups
Subject:D2009 read a string in a record from a file of record
Posted by: Hardee Mahoney
Date:Sat, 24 Apr 2010

Hello,

I am doing something wrong and I'm sure its because of the unicode string.  In place of String in the record type I think I should be using something like AnsiString[3] but that causes a syntax error.  Can some one help with what I'm doing wrong?  I am clearly not reading the string part correctly.

I have a record

  TCoalGasMatrixRec = record
    Fips : string[3];
    ii    : integer;
    dd : double;
  end;
  PCoalGasMatrixRec = ^TCoalGasMatrixRec;

and I am trying to read a file which matches this record.

var f : file of TCoalGasMatrixRec;
    Prec : PCoalGasMatrixRec;
    fips : string;
    ii: integer;
    dd: double;
begin
    AssignFile(f, edtFilename.Text);
    Reset(F);
    while not Eof(F) do
    begin
        new(Prec);
        Read(F, Prec^);
        fips := Prec^.Fips;
        ii := Prec^.ii;
        Showmessage('Fips: ' + fips);
    end;
    CloseFile(F);
end;

Thanks in advance

Hardee Mahoney
Washington, DC

Replies