Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

Text IO

DEFINITION MODULE TextIO;

(* Driver for Line Oriented Text IO *)

(* This module interprets the contents of files as a sequence of lines of text
   delimited by newline. The module is implemented on top of module FileIO. *)

FROM FileIO IMPORT File;


(* Read a line of text *)

PROCEDURE ReadLine ( file : File; VAR str : ARRAY OF CHAR );
(* Reads a line of text from <file> and passes it back in <str>. A runtime
   error is raised if the line exceeds the capacity of <str>. *)


(* Skip a line of text *)

PROCEDURE SkipLine ( file : File );
(* Read and ignore all characters up to and including the first newline. *)


(* Write a line of text *)

PROCEDURE WriteLine ( file : File; str : VARIADIC OF CONST ARRAY OF CHAR );
(* Writes a sequence of character strings as a line to <file>. The line is
   terminated by newline. *)


(* Write an empty line of text *)

PROCEDURE WriteLn ( file : File );
(* Writes an empty line to <file>. The line is terminated by newline. *)

END TextIO.