OK.
First.
When you write the file, you declare the file as Text.
So you create a plain textfile.
When you read the file, you declare the exact same file as a file of Integer.
So, when reading, it will interpret the binary contents as being a sequence of integers.
This is plain wrong.
E.g. if you write a length of 10, the file will contain 4 bytes: a byte coding for the characte '1', a byte coding for the character '0', a byte coding for carriage return and a byte coding for line-ending.
So you get these four bytes: $31 $30 $0D $0A
Now, when you read this textfile and make the compiler believe that what it reads is a binarytrepresentation of integers, it will read the first four bytes (=sizeof(integer)) and this will then be a value of 168636465!
So declare the type of file the same in both program (preferrably text, this way you can open the file in a text editor to see if the contenst are what you expect, this makes debugging easier).
Second.
When reading, the array of array of integer makes no sense.
You do not need that at all, plus you use it wrong.
Just read length and with and display them.
Mind you, I interpret the assignement so that if you have an input file like:
4
3
7
6
output should be like:
'lengte = 4, breedte = 3, oppervlak = 12'
'lengte = 7, breedte = 6, oppervlak = 42'
If you want to store the entire files contents in some sort of array, I would define a type that holds breedte en lengte as a record and have an array of that type.
type
TRechtHoek = record
lengte, breedte: Longint;
end;
var
arrRechthoek: array of TRechtHoek;
Third.
In the "RechthoekLezen" program you use a while loop.
Since you are going to ask the user at least once, a reapeat loop is more appropriate.
This also gets rid of the duplicate lines in that code.
Also, you should not write a RechtHoek with invalid values (currently you do write a 0 x 0 one to the file).
Pseudocode:
repeat
ask for lengte
read lengte
ask for breedte
read breedte
if (lengte>0) and (breedte>0) then write values to file
until either lengte or breedte <= 0
Fourth.
In general you should validate user input before storing them in a datatype you actually use for calculation.
User input should never crash a program.
In the "RechthoekLezen" program, what happens if the user inputs 9999999999999999999, or nonsense like 'foobar' when you read lengte or breedte?
The same goes for reading and writing to a file, there should be error checking there.
Also you allow negative values for lengte and breedte.
I know this is probably not part of your assignment, but still it's wrong.
Fifth
The structure of the data file makes it accident prone: you rely on the fact there will always be an even number of lines (assuming you use text files).
To me it would make more sense to punt lengte and breedte on 1 line, separated by a space.
But, the file format may actually be specified in the assignment, I don't know.
Bart