Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : FILEIO.MOD

 
Output of file : FILEIO.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 8 - Program 3 *)
MODULE FileIO;

FROM InOut IMPORT WriteString, WriteInt, WriteLn, Write, Read,
OpenInput, OpenOutput, CloseInput, CloseOutput,
Done;

IMPORT Terminal; (* This is used for monitor output *)
(* and InOut is used for the file *)
(* input and output. *)

VAR Character : CHAR;

BEGIN
REPEAT (* open the input file *)
Terminal.WriteString("Enter Input filename - ");
OpenInput("MOD");
UNTIL Done; (* Quit when open is successful *)

REPEAT (* open the output file *)
Terminal.WriteString("Enter Output filename - ");
OpenOutput("DOG");
UNTIL Done; (* quit when the open is successful *)

REPEAT (* character read/write loop - quit at EOF *)

Read(Character);
IF Done THEN (* Done = FALSE at EOF *)
Write(Character);
END;
UNTIL NOT Done;
CloseInput;
CloseOutput;

END FileIO.




(* Result of execution

(The selected file is copied to another file character by character.)

*)



  3 Responses to “Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : FILEIO.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/