That is a very good start. Now all you need to do is read data from the file and stick it in the record.
For the following examples, I have the hypothetical variable:
var person: tPerson;
The first thing to read is a string, all by itself on a line, so
readln( fileA, person.name );
works just fine.
In the Delphi IDE, place the cursor over the word
TDateTime and press
F1. You'll get the help for that type. Up at the top there is a link that says
See also. This will give you a list of things related to the
tDateTime, including functions to read and write it from string. I found
StrToDate in the list. So, you can read the next line as:
var dateString: string;
...
readln( fileA, dateString );
person.dateOfBirth = strToDate( dateString );
Don't forget that there is still that blank line to read:
readln( fileA );
Put these three together and you have read a single record from file and stored it in a Pascal-style
record.
You could make a function that does this for you:
function readPersonRecordFromFile( var file: TextFile ): tPerson;
var dateStr: string;
begin
readln( file, result.name );
readln( file, dateStr );
result.dateOfBirth = strToDate( dateStr );
readln( file )
end;
Keep working at it. Hope this helps.
PS. I'm not too fond of just giving code away when you are learning something new. Please pay attention to the thought process that went into creating this function. Now, you must still
use the function to read all the "records" in the file into your
array of tPerson.