
write - writes the values of variables into a file

Calling sequence:
write(integer [  , identifier ... ]   )
write( [ type, ]  string [  , identifier ... ]   )

Parameter:
integer      --  non-negative integer
type         --  one of the options Bin or Text
string       --  character string
identifier   --  identifier

Overloading:

1

Summary:

write saves the values of the variables given by identifier into a file. If no
variable is given then all variables are saved, including the library routines
and environment variables.  With this a complete MuPAD session can be
saved. The stored values can be read with read.

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

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

  o  If the value 0 is given as the first argument then the output is printed
     on the screen.

  o  Is the argument given is a string, the corresponding file will be opened.
     Already stored data in this file are overwritten. If the file does not exist
     it will be created.
     If write is called on the interactive level in MacMuPAD then the user
     is warned before the file is overwritten.  The operation can then be
     terminated.
     If the variable WRITE_PATH  has a value then the file is created in this
     directory; if not it is created in the working directory.  (This is the
     directory in which MuPAD was started.)
     If, additionally, one of the options Bin or Text is given then the file is
     opened as a binary or text file.  If this option is not given the file is
     opened as a binary file.
     After the output is written 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

When reading in a complete session with read, please remember that the
new session must be started in the same environment as the stored session

was started in. (The stored data sometimes contain path names of files still
to be read.)

With textual storage the variable values are stored as assignments of the form

     identifier := hold(expr):

For instance after a:= b+1; b:= 3; the variables a and b are stored as a:=
hold(b+1):  b:= hold(3):. write is a kernel function.

>>  a:= b+1: write(Text,"test",a):
    ftextinput("test");

      "a:= hold(b+1):"

>>  reset(): read("test"): a;

      b + 1

See also:  fclose , fopen , fprint , protocol , read, WRITE_PATH

