I'm trying to build a procedure that will read an array of 'real' values from a prepared ASCII file and then do some drawing based on those values. Initially, I got hung up with syntax errors but eventually got an experimental procedure that would sort of read the supplied data file.
The problem I have is VS does not seem to reset the record-marker to BOF. It reported, as I recall, the final three values out of a set of 16. I decided to build a test-procedure that allowed VS to write its own file and then read it. That script is pasted in below. The supplied procedure, 'A_test', reads the last value OK, but reports zeros for the other seven.
Does anyone have any idea how to overcome this mode of operation?==================================================PROCEDURE A_test;VAR a1,a2,a3,a4,a5,a6,a7,a8 :REAL; b1,b2,b3,b4,b5,b6,b7,b8 :REAL; filespec : STRING;BEGIN a1 := 1.1; a2 := 2.2; a3 := 3.3; a4 := 4.4; a5 := 5.5; a6 := 6.6; a7 := 7.7; a8 := 8.8; PutFile('What file?','The output',filespec); IF NOT DidCancel THEN BEGIN WriteLn(a1); WriteLn(a2); WriteLn(a3); WriteLn(a4); WriteLn(a5); WriteLn(a6); WriteLn(a7); WriteLn(a8); Close(filespec); END;{file-write} Open(filespec); WHILE NOT EOF(filespec) DO ReadLn(b1); ReadLn(b2); ReadLn(b3); ReadLn(b4); ReadLn(b5); ReadLn(b6); ReadLn(b7); ReadLn(b8); Close(filespec);Message(b1,' ',b2,' ',b3,' ',b4);Wait(5);Message(b5,' ',b6,' ',b7,' ',b8);END;RUN(A_test);==================================================I notice that Pascal has a 'RESET' instruction that moves the marker to BOF, but I don't see that option in VS!
I'll be grateful for any advice on this issue. TIA.