home *** CD-ROM | disk | FTP | other *** search
-
-
- '********** BIGPUT.BAS - demonstrates saving and loading an entire array
-
- 'Copyright (c) 1989 Ethan Winer
-
-
- DEFINT A-Z
-
- DECLARE SUB BigSave ALIAS "B$PUT3" (BYVAL FileNumber, SEG Address, _
- BYVAL NumBytes)
- DECLARE SUB BigLoad ALIAS "B$GET3" (BYVAL FileNumber, SEG Address, _
- BYVAL NumBytes)
- DECLARE SUB BigSaveS ALIAS "B$PUT4" (BYVAL FileNumber, BYVAL SeekLoc&, _
- SEG Address, BYVAL NumBytes)
- DECLARE SUB BigLoadS ALIAS "B$GET4" (BYVAL FileNumber, BYVAL SeekLoc&, _
- SEG Address, BYVAL NumBytes)
-
- CONST NumEls% = 10000 'the size of the test array
- DIM Array(1 TO NumEls%) 'create an integer array
- FOR X = 1 TO NumEls% 'initialize it to ascending values
- Array(X) = X
- NEXT
-
- OPEN "BigTest" FOR BINARY AS #1 'create the output file
- BigSave 1, Array(1), NumEls% * 2 'file #1, array start, number of bytes
- CLOSE #1 'close the file
-
- FOR X = 1 TO NumEls% 'clear the array to prove we loaded
- Array(X) = 0 ' it again later
- NEXT
-
- OPEN "BigTest" FOR BINARY AS #1 'open the file again
- BigLoad 1, Array(1), NumEls% * 2 'load the entire array at once
- CLOSE #1 'close the file
-
- FOR X = 1 TO NumEls% 'print the results to prove it works
- PRINT Array(X),
- NEXT
-