Width # Statement

Set the string width for the files opened with the Open statement.

Syntax

Width #filenumber, width

The Width # sintax contains these parts:

Part Description
filenumber Required. Any valid file number.
width Required. Numeric expression with the 0–255 range inclusive. Sets how many symbols to write to a line before going over to a new line. If width equals 0 (default value), line width is not limited. The default value of the width argument is 0.

Example

In the example below the Width # statement is used to set the line width for writing to the file.

Dim I
Open "TESTFILE" For Output As #1  ' Open file for writing.
Width #1, 5                       ' Set width to  5.
For I = 0 To 9                    ' The loop repeats 10 times.
    Print #1, Chr(48 + I);        ' Print 5 characters per line.
Next I
Close #1                          ' Close the file.

 

See Also

Open Statement, Print # Statement