Contents / Reference section / BASIC keywords / Previous letter / Next letter / Index
Numbers and words can be recorded on cassette tape and on floppy discs. The function BGET# enables a single character or number to be read back into the computer from the cassette, disc or network. Before using this statement a file must have been opened using the OPENIN function or else an error will occur (see page 188 for more information about "files"). When a file is opened, using OPENIN, the computer will allocate the file a channel number. This number must be used in all subsequent operations on the file, for example when reading the file or when writing a new file. Again see the chapter on file handling, page 188, for more information.
6000 character=BGET# (channel)
340 next_letter%=BGET#C
A function which gets a byte from the file whose channel number is the argument. The file must have been opened before this statement is executed.
<num-var>=BGET#<num-var>
OPENIN, OPENOUT, CLOSED, EXT#, PTR#, PRINT#, INPUT#, BPUT#, EOF#
To store a byte on the cassette or disc. See page 188 for a more detailed description of file handling. The number which is sent to the file can have any value between 0 and 255. If you attempt to store a number that is greater then 255 then 256 will be repeatedly subtracted from the number until it is less than 256. The final number will then be sent to file. (This statement is used to store single bytes - not large numbers. Large numbers can be stored using PRINT#.) As with BGET# the file must be "open" before this statement can be used.
30 BPUT# channel,number
700 BPUT#N,32
450 BPUT# STAFF_FILE,A/256
A statement which puts a byte to the file whose channel number is the first argument. The second argument's least significant byte is sent. The file must be open before this statement is executed.
BPUT#<num-var>, <numeric>
OPENIN, OPENOUT, CLOSE#, EXT#, PTR#, PRINT#, INPUT#, BGET#, EOF#