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

IO Module ARRAYOFCHAR

DEFINITION MODULE ARRAYOFCHAR;

(* I/O Module for ARRAY OF CHAR Types *)

FROM FileIO IMPORT File;

PROCEDURE Read ( infile : File; VAR s : ARRAY OF CHAR );
(* Reads a string value from stream infile
   - any leading whitespace is skipped
   - the character being read is removed from infile
   - the code point of the character value read is assigned to s
   - the file status is set to any of:
     success, outOfRange, wrongFormat, endOfLine, or endOfInput.
   This function is substituted for invocations of READ with an
   ARRAY OF CHAR type argument. *)

PROCEDURE Write ( outfile : File; s : ARRAY OF CHAR );
(* Writes string s to stream outfile. This function is substituted
   for invocations of WRITE with an ARRAY OF CHAR type argument.*)

PROCEDURE WriteF ( outfile      : File;
                   CONST fmtStr : ARRAY OF CHAR;
                   items        : VARIADIC CONST OF ARRAY OF CHAR );
(* Writes a formatted textual representation of one or more ARRAY OF CHAR
   values to output stream outfile. The output format is determined by fmtStr.
   This procedure is substituted for invocations of WRITEF with one or more
   ARRAY OF CHAR arguments. *)

END ARRAYOFCHAR.