Chapter
10
I
BASIC Keywords
PUT/Communications Statement
PUT
[
#
1
buffr
,
num
ber
Transfers data from the communications buffer to the communi-
cations line.
Buffer
is the number assigned
to
the file when you opened it.
The number sign
(#)
is optional. It is provided for compatibility
with other BASICs.
Number
is the number
of
bytes to transfer. It cannot exceed the
value you used in the LEN option in the OPEN COM statement.
Note:
Because
of
the low performance associated with
telephone line communications, we recommend that
you
not
use GET and PUT statements in such
applications.
Example
PUT
2,80
transfers 80 bytes from communications buffer (Buffer
2)
to the
communications line.
Sample
Program
10 OPEN "COM1
:I'
AS
1
20 FIELD 1,
8
AS
A$
30
OPEN
"R"
,3,
"da
t
a
.
f
i
1
"
,8
40 FIELD
3,
8
AS
NS
50 FOR
I
=
1
TO
7
60 GET 3,
I
70 LSET A$=N$
80
PUT
1
,8
90 NEXT
I
100
CLOSE
This program moves the data from the
data.fiZ
file buffer
to
the
communications buffer. Line 80 sends the data in the communi-
cations buffer to the communications line.
281