Width # Statement

Description

Assigns an output-line width to a file opened using the Open statement.

Syntax

Width #filenumber,width

The Width statement syntax has these parts:

Part

Description

filenumber

Any valid file number.

width

Numeric expression in the range 0 to 255, inclusive, that indicates how many characters appear on a line before a new line is started. If width equals 0, there is no limit to the length of a line. The default value for width is 0.


See Also

Open Statement, Print # Statement.

Example

This example uses the Width statement to set the output-line width for a file.


Open "TESTFILE" For Output As #1    ' Open file for output.
Width #1, 5    ' Set output-line width to 5.
For I = 0 To 9    ' Loop 10 times.
    Print #1, Chr(48 + I);    ' This prints 5 characters per line.
Next I
Close #1    ' Close file.