t90_fileio.pas 805 B

1234567891011121314151617181920212223242526272829303132333435
  1. program t90_fileio;
  2. { t90 -- typed-file block I/O. CALC.INC's Save and Load do
  3. write (MCfile, Sheet[I,J]);
  4. read (MCFile, Sheet[FX,FY]);
  5. where MCFile is `file of CellRec' and the data argument is a record
  6. element. This fixture compiles the scalar and variable-address forms and
  7. the file operations around them. It is compile-only: neither boot harness
  8. has a filesystem, so there is no honest hand-derived execution output for a
  9. successful open/read/write. }
  10. type
  11. Rec = record
  12. A, B : integer;
  13. end;
  14. var
  15. F : file of Rec;
  16. X : Rec;
  17. Rows : array [1..2] of Rec;
  18. begin
  19. assign (F, 'T90.DAT');
  20. rewrite (F);
  21. X.A := 1;
  22. X.B := 2;
  23. write (F, X);
  24. write (F, Rows[1]);
  25. reset (F);
  26. read (F, X);
  27. read (F, Rows[2]);
  28. close (F);
  29. writeln ('file io compiled')
  30. end.