put - write record from random buffer to random file


put [#]FileNum[, NumExpr]


FileNum is the number under which the file was opened.  NumExpr is the record number for the record to be written.  If NumExpr is omitted, the next record number in sequence is assumed. 


In the following example, the lset and rset statements in lines 30 through 50 place the information in a buffer.  The put statement in line 60 writes the buffer to the random file "addrph". 
	10 open "addrph" as #1 len = 150
	20 field 1, 35 as n$, 80 as a$, 12 as ph$
	30 lset n$ = "Basmark Corporation"
	40 lset a$ = "1717 East Ninth Street, Cleveland, Ohio"
	50 rset ph$ = "800-555-1212"
	60 put 1
	70 close 1


field, get, lset, open, rset


Any attempt to read or write past the end of the buffer causes a "Field overflow" error. 

If FileNum is less than 1 or greater than the maximum number of open files, or if FileNum is not open, a "Bad file number" error occurs. 

If FileNum is not open for random access, a "Bad file mode" error occurs. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber