Please look at my code snippets below. I am reading data from a file created by an old DOS app. My code works, I can read the file. My question is, am I correct in using the array[] of char to store the data. If so, how can I get the arrays into strings so I can manipulate them and then get the strings back into the arrays before writing to the file. Is there some sort of ArrayToString() function or StrToArray() function? I understand that Delphi strings are arrays, but trying to assign the array to a string generates an error. Or is there an entirely better way to do this? I await enlightenment from Delphi gurus. Thank you.
type
TInven = packed record
Item : array[1..21] of char;
Group: array[1..15] of char;
Descr: array[1..21] of char;
procedure TForm1.SayEm;
var
Armor : File of TInven;
InvData : TInven;
begin
gGoRec := StrToInt(Edit1.Text);
if FileExists('ADIN1001.DAT') then
begin
AssignFile(Armor,'ADIN1001.DAT');
FileMode := 0; {read only}
Reset(Armor);
Seek(Armor,gGoRec);
Read(Armor,Invdata);
end;
with InvData do
begin
Label1.Caption := Item;
Label2.Caption := Group;
Label3.Caption := Descr;
etc...
type
TInven = packed record
Item : array[1..21] of char;
Group: array[1..15] of char;
Descr: array[1..21] of char;
procedure TForm1.SayEm;
var
Armor : File of TInven;
InvData : TInven;
begin
gGoRec := StrToInt(Edit1.Text);
if FileExists('ADIN1001.DAT') then
begin
AssignFile(Armor,'ADIN1001.DAT');
FileMode := 0; {read only}
Reset(Armor);
Seek(Armor,gGoRec);
Read(Armor,Invdata);
end;
with InvData do
begin
Label1.Caption := Item;
Label2.Caption := Group;
Label3.Caption := Descr;
etc...