TestReader.Mod 451 B

12345678910111213141516171819
  1. MODULE TestReader;
  2. IMPORT Out, Texts;
  3. VAR T: Texts.Text; R: Texts.Reader; S: Texts.Scanner;
  4. ch: CHAR;
  5. BEGIN
  6. NEW(T); Texts.Open(T, 'Data/TEXT.DAT');
  7. Texts.OpenScanner(S, T, 1); Texts.Scan(S);
  8. Out.String(S.s); Out.Char(';'); Out.Ln;
  9. Texts.OpenReader(R, T, 0);
  10. Texts.Read(R, ch);
  11. WHILE ~R.eot DO
  12. Out.Int(ORD(R.eot), 5);
  13. Out.Int(ORD(ch), 5); Out.String(' ');
  14. Out.Char(ch); Out.Ln;
  15. Texts.Read(R, ch)
  16. END
  17. END TestReader.