Hello jcop,
since you have Delphi 2005 (or at least that's what your userprofile says
), the following method should work:
I'll show this for your first file, the Aircraft.txt. It works the same for all other files
Delphi-Quellcode:
type
TAircraft=record
sIndex, sDesc: String;
iNumber: Integer;
end;
//....
var
i: Integer;
SL1: TStringList;
SL2: TStringList;
Aircraft: array of TAirCraft;
begin
SL1 := TStringList.Create(Self);
SL2 := TStringList.Create(Self);
try
SL1.LoadFromFile('aircraft.txt');
//SL1 now contains all the lines stored in aircraft.txt
SetLength(AirCraft, SL1.Count);
for i := 0 to SL1.Count-1 do
begin
SL2.CommaText := SL1.Lines[i];
{SL2 now contains all the different entries that were separated by a comma. Note that the description can't contain commas}
with Aircraft[i] do
begin
sIndex := SL2.Lines[0];
iNumber := StrToIntDef(SL2.Lines[1], 0);
sDesc := SL2.Lines[2];
end;
end;
finally
SL1.Free;
SL2.Free;
end;
end;
After that, the Aircraft-Array stores all your aircraft. Just return that array as a var parameter, and you should be set. For the other files it works equal, but if you have any problems, feel free to ask
Greetz
alcaeus