BCX Console Demonstration Program s113.bas

 DIM A$ * 5000
 
 OPEN "JUNK.BIN" FOR BINARY NEW AS FP1  ' ************************** 
 A$ = REPEAT$(500, CHR$(248)) & "Hello" '     Create a data file 
 PUT$ FP1, A$, LEN(A$)                  '         to explore 
 CLOSE FP1                              ' ************************** 
 
 CLS
 OPEN "JUNK.BIN" FOR INPUT AS FP1       ' ************************** 
 SEEK  FP1,500                          '  Now lets read it, 
 
 GET$  FP1,A$,5                         '  Grab 5 bytes near end of file 
 A[5]  = 0                              '  Null terminate A$ for safety 
 PRINT A$                               '  Display it 
 
 SEEK  FP1,0                            '  go back to the beginning 
 GET$  FP1,A$,1000                      '  of the file 
 PRINT
 PRINT A$                               '  and clean up after 
 CLOSE FP1                              '  ourselves. 
 KILL  "JUNK.BIN"                       ' **************************