core

## Writing a Block of Text to a File

The Insert | File I/O Command | Writing Commands | Write Block menu option inserts a command into the Edit window that causes a block of text to be output to a disk file upon execution. Use expression syntax to output the variables and measurement routine information to file. Unlike the write line command, write block does not append a carriage return at the end.

The syntax of this command in the Edit window is:

File/WriteBlock,<fptrname>,<expr>

Descriptions for some of the components of this command are:

<fptrname>
This is the name of the file reference specified when the file was opened.

<expr>
This is the text to be written to file. Expressions can be used in this field.

Unlike the write line command, write block does not append a carriage return at the end. However, if you need to place text on a new line inside your text block, you can insert a carriage return and line feed manually by using the CHR(10) code outside of your quoted string, as shown here in this example:

FILE/WRITEBLOCK,FPTR, "CHR(10) inserts text... " + CHR(10) + " ...on a new line."

This would yield this result inside your output file:

CHR(10) inserts text...

...on a new line.

Notice that if CHR(10) is inside the quotation marks the actual text of CHR(10) gets sent to the file.

To access the dialog box associated with this File I / O command:

1. Open the Edit window.

2. Place your cursor on the Write Block command.

3. Press F9.

More:

Sample Code for Write Block