ChaDter
10
I
BASIC
Kevwords
WIDTH
Statement
WIDTH
[LPRINT]
size
WIDTH
buffer,
size
WIDTH
device,
size
Sets the line width in number
of
characters for the display, line
printer, or communication channel.
Size
may be an integer in the range 0
to
255 that specifies the
number
of
characters in a line.
For
the screen,
size
may be only
20, 40,
or
80.
Buffer
is an integer in the range 0
to
15 and specifies the
buffer
used in the OPEN statment.
When you specify
buffer,
BASIC changes the width immediately.
This lets you change the width when the file is open. To return
to
the previous width, execute another WIDTH statement,.
Device
is
a
valid device enclosed in quotation marks that speci-
fies on which
device
you want
to
set the width. See Chapter
1
for
valid device names.
When you specify
device,
BASIC stores the new width and does
not change the current width of the device. When a subsequent
OPEN statement opens that device, BASIC
uses
the new width
while the file
is
open. After you close the file, the device returns
to
the previous width.
When you set the width for the line printer, BASIC sends a car-
riage return after every
size
character.
For
example:
10
WIDTH LPRINT 100
20 LPRINT "This line is
100
character5 long.
See
what happen5 when
you
print
a
5tring longer than
width
.
"
Line 10 sets the printer width
to
100 characters. After printing
100 characters, BASIC issues
a
carriage return. The carriage re-
turn causes the printer
to
print the remaining characters on the
next line.
342