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. Syntax [string2 :=] WRITE_FILE ({buffer|range} [,string1] [, {ON|OFF|1|0}) 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, TPU uses the output file associated with the buffer. If there is no associated output file, TPU prompts for one. ON or 1 The output will be padded with spaces to keep the first character of each record at the same column as the text in the buffer. By default, padding is ON. OFF or 0 No padding spaces will be inserted when writing to the file. 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", OFF); 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. WRITE_FILE (select_range, READ_LINE ("Output file: "), ON); Writes out the select range to a file, using READ_LINE to prompt for the output file specification. The lines are padded, so the text in the file is: 1 This is line 2 Thi Related topics EXIT QUIT READ_FILE SET(NO_WRITE) SET(OUTPUT_FILE)