Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 793 Bytes

File metadata and controls

37 lines (30 loc) · 793 Bytes

Terminal

Low-level terminal I/O module. Provides single-character and string output without formatting. Simpler alternative to InOut for basic terminal interaction.

Exported Procedures

PROCEDURE Read(VAR ch: CHAR);
PROCEDURE Write(ch: CHAR);
PROCEDURE WriteLn;
PROCEDURE WriteString(s: ARRAY OF CHAR);

Notes

  • Read reads a single character from standard input.
  • Write writes a single character to standard output.
  • Unlike InOut, Terminal does not provide formatted numeric output or the Done status variable.

Example

MODULE TermDemo;
FROM Terminal IMPORT Read, Write, WriteLn, WriteString;
VAR ch: CHAR;
BEGIN
  WriteString("Press a key: ");
  Read(ch);
  WriteLn;
  WriteString("You pressed: ");
  Write(ch);
  WriteLn;
END TermDemo.