Input/Output Functions.

  1. In each of the following functions, the value of

    EXPR

    must be a string that is a file name consistent with the operating system's naming conventions. The value of the function has ISETL type file and may be in

    read

    ...

    from

    ... and

    print

    ...

    to

    ... statements to refer to that file.

    1. openr(EXPR)

      . If the file named by the value of

      EXPR

      exists, then it is opened for reading, and the value of the function is of type file. If the file named by the value of

      EXPR

      does not exist, then the value of the function is

      OM

      .

    2. openw(EXPR)

      . If the file named by the value of

      EXPR

      does not exist, then it is created by the operating system externally to ISETL. This file is opened for writing from the beginning, so that anything previously in the file is destroyed. The value of the function is of type file.

    3. opena(EXPR)

      . The same as

      openw(EXPR)

      except that if the file exists its contents are not destroyed. Anything that is written is appended to the file.

  2. In the following function, the value of

    EXPR

    must be of type file. The file specified by this value is closed. Output files must be closed to guarantee that all output has been stored by the operating system. All files are closed automatically when ISETL is exited. There is usually a system-imposed limit on the number of files that may be open at one time, however, so it is a good idea to close files when finished using them.

    1. close(EXPR)

      . The value of the function is

      OM

      .

  3. In the following function the value of

    EXPR

    must be of type file.

    1. eof (EXPR)

      . Test for having read past the end of an external file.