
read - searches, reads and executes a file

Calling sequence:

read(integer)
read(string)

Parameter:
integer   --  positive integer
string    --  character string

Summary:

read reads-in the contents of a file and executes the statements in the file.
(Naturally the file must contain valid MuPAD statements.) read returns the
value of the final executed statement as its result.

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

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

 o  If a character string is given with the argument string then the file
    with this name is opened.
    At first the file is searched for in the directories given by the system
    variable READ_PATH .  Then it is searched for in the current directory.

     (This is the directory in which MuPAD was started.) Finally the file is
     searched for in the directories given by the variable LIB_PATH .

     After the data have been read-in the file is closed.
  o  If, in MacMuPAD, an empty character string is given with the argument
     string then a dialogue is opened in which the user can choose a file.

read returns the error Can't read from file when the data cannot be
read-in.

>>  a:=3: b:=5: write("testfile.mb",a,b): reset():
    a, b; read("testfile.mb"): a, b;

      a, b
      3, 5

See also:  fclose , finput , fopen , fread , ftextinput , LIB_PATH , READ_PATH ,
write

