
fprint - output in a file

Calling sequence:
fprint([ Unquoted, ]  integer, expr ...)
fprint([ Unquoted, ]  [ type, ]  string, expr ...)

Parameter:
Unquoted   --  option
integer    --  non-negative integer
type       --  one of the options Bin or Text
string     --  character string
expr       --  expression

Summary:

fprint is used for the output of values in a file.  The argument expr is
evaluated and the result output.  If several arguments are specified they
are evaluated sequentially and output.  Text output occurs without the
Pretty-Printer. Usually there is a colon between each value so that the output
can be read-in again using finput . After output a new line is started.

If the option Unquoted is given as the first argument then character strings
without the final quotation marks are output. Furthermore, at the end of a

line no colon occurs.  Generally data output in this way cannot be read-in
again by using finput.

Not only expressions can be used as arguments, but also any statement can
be used, e.g. also assignments or procedure definitions.  Statements must,
however, be additionally bracketed, e.g. as in fprint("test.mb",(a:=2)).

fprint returns an object with the type DOM_NULL    as the result.

The file can be specified by its name or with a file descriptor:

  o  If the positive integer integer is given then this is considered the file
     descriptor. The corresponding file must have already been opened with
     fopen .

  o  If the value 0 is given as a non-negative integer then output takes place
     on the monitor.

  o  If a character string is given with the argument string then the file
     with this name is opened. If this file does not yet exist then it is newly
     created. Any data already in the file is overwritten.

     In MacMuPAD, if fprint is called on the interactive level then the user
     is warned about the overwriting of data.  The operation can then be
     terminated.

     If, additionally, one of the options Bin or Text is given then the file is
     opened as a binary or, respectively, a text file.  Without one of these
     options the file is opened as a binary file.

     After data have been output the file is closed.

  o  In MacMuPAD, if an empty character string is given by the argument

     string then a dialogue is opened in which the user can choose a file.

fprint is a kernel function.

>>  fprint(Bin, "test1.mb", (d:=5), d*3):
    finput("test1.mb", e, f): e, f;

      5, 15

>>  fprint(Unquoted, Text, "test2.mu", "Hello ", " World !"):
    ftextinput("test2.mu");

      "Hello : World !"

See also:  fclose , fopen , print , protocol , write

