printa

From the SETL Wiki

Jump to: navigation, search
printa
Category I/O
Syntax function
Compatibility
CIMS SETL yes
SETL-S yes
SETL2 yes
GNU SETL yes

Contents

Purpose

Print to output stream.

Synopsis

 printa(file, arg [, ...]);

Description

Prints each argument to the specified, separated by spaces (except in SETL-S (see bugs) SETL2), and terminated by a newline.
String arguments are written directly. Non-string arguments are first converted using the str operator.

Examples

  1. printa("foo.txt", "Hello, World");
    

    outputs "Hello, World" to the file "foo.txt".

  2. printa("foo.txt", 1, 2);
    

    outputs "1 2" to the file "foo.txt".

  3. h := open("foo.txt", "TEXT-OUT");
    printa(h, 1, 2);

    outputs "1 2" to the file "foo.txt".

Bugs

  • The documentation for SETL-S claims that the printed values are separated by spaces, but they are not.

Notes

  • The type of the file parameter varies slightly between SETL implementations:
    • In CIMS SETL and SETL-S, file must be the name of a file previously opened for writing.
    • In SETL2, file must be a handle obtained from the open function.
    • In GNU SETL, file may be either a filename or a file descriptor. If the name of an unopened file is given, the file is automatically opened for writing.
  • In SETL2, the programmer can redefine the str function, in which case printa will use the user-defined version in preference to the built-in version.
Personal tools