The major text input and output operations in Parallaxis are shown below (ASCII data). I/O operations do not generate run-time errors (e.g. in case of inappropriate data to be read or in case of insufficient disk space during a write operation). Instead, the scalar boolean variable Done is set according to the success of the I/O operation. This variable can be checked to perform appropriate actions, in case its value is FALSE. When reading strings, integers, cardinals, reals, or booleans, the scalar character variable termCH is set to the next unread character in the input stream, which was responsible for terminating the read operation. EOL is a constant of type character, which stands for the system-dependent end-of-line character.
WriteLn; Start a new line (no arguments) Write(c); Write character c WriteString(s) Write string s WriteInt(i,l); Write integer i using l print spaces (add blanks in front of the number) WriteCard(c,l); Write cardinal c using l print spaces WriteReal(r,l); Write real r using l print spaces WriteFixPt(r,l,m); Write real r using l print spaces and m decimals WriteBool(b); Write boolean b Read(c); Read character c ReadString(s) Read string s ReadInt(i); Read integer i ReadCard(c); Read cardinal c ReadReal(r); Read real r ReadBool(b); Read boolean b OpenOutput(s); Open file with name s for writing (following write operations write to file) CloseOutput; Close file, redirect output to stdout OpenInput(s); Open file with name s for reading (following read operations read from file) CloseInput; Close file, redirect input back to stdinThe following gives a number of sample write operations; read operations work the same way.
VAR i: INTEGER;
r: REAL;
...
WriteString("Hello"); (* write string on screen *)
WriteInt(i,7); (* write integer value using 7 print spaces *)
WriteLn; (* start writing in a new line *)
OpenOutput("myfile"); (* open file, redirect output to file *)
WriteString("Hello");(* write string to file *)
WriteFixPt(r,9,2); (* write r to file in 9 print spaces with 2
decimals*)
CloseOutput; (* close file, output back to screen *)
WriteString("Hello"); (* write string on screen *)