Modula-2 || Compiler & Tools || Library || Search Engine

Ulm's Modula-2 Library:


F - formatted output to files


(* diagnostic *)
PROCEDURE success() : FmtExitCode;

(* error handling *) PROCEDURE setmode (mode : BITSET); PROCEDURE getmode (VAR mode : BITSET);

(* output *) PROCEDURE printf0 (file : FILE; fmt : ARRAY OF CHAR); PROCEDURE printf1 (file : FILE; fmt : ARRAY OF CHAR; i1 : ARRAY OF BYTE); PROCEDURE printf2 (file : FILE; fmt : ARRAY OF CHAR; i1,i2 : ARRAY OF BYTE); (* ... *) PROCEDURE printf8 (file : FILE; fmt : ARRAY OF CHAR; i1, i2, i3, i4, i5, i6, i7 , i8 : ARRAY OF BYTE);


printf0 .. printf8 convert their parameters , instantiate them into the format string fmt and write the resulting text to the file file Refer to Printf for a detailed description of formatting capabilities.

The output to file is echoed after suitable calls of LongStrings.Echo.

done returns TRUE if the last call of printf0 .. printf8 was successful, more detailed information can be obtained by success (FmtExitCode is imported from Printf).

setmode defines a new error handling mode mode which is by default set to Printf.Default. getmode yields the current mode.


Diagnostic is unnecessary unless default error handling strategy has been explicitly modified by prior calls of setmode. See Printf for more details.

Besides for reasons of illegal format strings, printf1 .. printf8 will fail if file cannot be written (error code CannotWriteFile).

Error messages issued by F will contain information about the their reason (including a system message if available) and the affected procedure call:

[fatal] F.printf0(...,"Hallo.\n");
        Bad file number: cannot write to file.
[a.out] Exit code 202. Stop.


Printf, StdIO, LongStrings


Werner Stanglow
Edited by: borchert, last change: 1997/02/25, revision: 1.2, converted to HTML: 1997/04/28

Modula-2 || Compiler & Tools || Library || Search Engine