Syntax |
Width# filenumber,newwidth |
|
Description |
Specifies the line width for sequential files opened in either Output or Append mode. |
|
Comments |
The Width# statement requires the following parameters: |
|
|
Parameter |
Description |
|
filenumber |
Integer used by the Basic Control Engine to refer to the open fileāthe number passed to the Open statement. |
|
newwidth |
Integer between 0 to 255 inclusive specifying the new width. If newwidth is 0, then no maximum line length is used. |
|
When a file is initially opened, there is no limit to line length. This command forces all subsequent output to the specified file to use the specified value as the maximum line length. The Width statement affects output in the following manner: if the column position is greater than 1 and the length of the text to be written to the file causes the column position to exceed the current line width, then the data is written on the next line. The Width statement also affects output of the Print command when used with the Tab and Spc functions. |
|
Example |
This statement sets the maximum line width for file number 1 to 80 columns. Const crlf$ = Chr$(13) + Chr$(10) Sub Main() Dim i,msg1,newline$ Open "test.dat" For Output As
#1 'Create data file. For i = 0 To 9 'Print
0-9 again. This time, five characters print before line wraps. msg1 = "The effect of the Width
statement is as shown below: " & crlf MsgBox msg1 'Display effects
of Width. |
|
See Also |
Print (statement); Print# (statement); Tab (function); Spc (function) |
W |