Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

VAXTPU WRITE_FILE — VMS 5.5-2H4

 WRITE_FILE

 Writes the contents of a buffer or range to a specified file or to the
 output file associated with the buffer; optionally returns a string for
 the output file specification.  Any text written to the file is padded
 with spaces to keep the output in the same columns as it was in the
 editor.

 Syntax

    [string2 :=] WRITE_FILE ({buffer | range} [,string1])

 Parameters

    buffer          The buffer whose contents you want to write to a file.

    range           The range whose contents you want to write to a file.

    string1         The output file specification.  If you do not specify a
                    file, VAXTPU uses the output file associated with the
                    buffer.  If there is no associated output file, VAXTPU
                    prompts for one.

 Examples

 All examples assume a buffer with the following text.  Each line has a
 left margin of 6.  The select range runs from the '1' to the first 'i' in
 line 3.

      This is line 1
      This is line 2
      This is line 3

 1.  WRITE_FILE (CURRENT_BUFFER, "myfile.txt");

     Writes out the current buffer to a file called MYFILE.TXT in your
     current (default) directory.  Each record in the file will be preceded
     by five spaces to keep the 'T' in each record in column 6.

 2.  out_file := WRITE_FILE (select_range, "myfile.txt");

     Stores in the variable OUT_FILE the file specification used for
     writing out the select range.  The file contains the following text:

         1
          This is line 2
          Thi

 3.  r1 := SELECT_RANGE;
     POSITION (temp_buffer);
     COPY_TEXT (select_range);
     SET (RECORD_ATTRIBUTE, temp_buffer, LEFT_MARGIN, 1);
     WRITE_FILE (temp_buffer, READ_LINE ("Output file: "));

     Uses COPY_TEXT to move the text to a temporary buffer to remove
     padding before writing the selected text to a file.  The READ_LINE
     built-in prompts for the output file specification.  The resulting
     file contains the following text:

     1
     This is line 2
     Thi

 Related topics

    EXIT   QUIT   READ_FILE   SET(NO_WRITE)   SET(OUTPUT_FILE)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026