Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
WIDTH Statement Programming Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
'This example uses the WIDTH statement to set different widths for file #1
'(a terminal on COM1).
CLS
'Open the port at the proper baud rate
OPEN "COM1:9600,N,8,1,ASC,LF" FOR OUTPUT AS #1
'Set Up a test string
Test$ = "1234567890"
'Change width to 3
WIDTH #1, 3
PRINT #1, Test$
'Change width to 4
WIDTH #1, 4
PRINT #1, Test$
'Delay 3 seconds so you can observe the results on the terminal.
SLEEP 3
'Close the file
CLOSE #1
'Sample Output (On a printer or terminal attached to COM1)
'
'123
'456
'789
'0
'1234
'5678
'90