Hello
I have been trying to get past certein exercises in Pascal but for some reason I always run into problems that I don't understand. I have the following (synthesized)
TYPE
Triangle = RECORD
x, y, z : word;
END;
Triangles = ARRAY OF Triangle;
{more code}
TriangleSize : integer = sizeof(Triangle);
assign(src,'triangle.dat');
reset(src,TriangleSize);
size := integer(filesize(src));
setlength(ts,size);
view_triangle(ts[0]); readln; //SHOWS "(0, 0, 0)"
blockread(src,ts,size,numRead);
view_triangle(ts[0]); readln; //EXIT CODE 216
FOR i := 0 TO size DO BEGIN
write('i = ',i,': '); view_triangle(ts[i]);
END;
close(src);
I just don't understand why the array elements are unaccesible AFTER the BLOCKREAD. The docs are clear, the array is dynamic, SRC is untyped, I know there is 1 record because I have run another script that saves exactly 1 record with BLOCKWRITE. I used to have a procedure that would populate a global array but now I condensed everything to the bare minimum to find the error. Does exit code 216 mean that the dynamic array is now inaccessible? ( T.T)>