BCX Console Demonstration Program S115.bas

 DIM I AS INTEGER
 
 CONST TenMillion = 10 * 1000 * 1000
 
 OPEN "Test" FOR BINARY NEW AS Fp1
 
 DIM A$ * TenMillion + 1            ' a VERY LARGE STRING
 
 ! memset(A,65,TenMillion);         // memset is a lowercase  "C" stdlib func
 
                                    ' In this example, we set every byte in A$
 PUT$  Fp1, A$, LEN(A$)             ' to ASCII 65 ( the letter "A" )
 CLOSE Fp1                          ' then write A$ out to a file in one swoop
 ' The whole process takes about 2 seconds
 ' on my 300mhz Pentium
 
 I = LOF("TEST")                    ' So, how big is the file?
 PRINT "LENGTH OF TEST FILE IS", I  ' If it's TenMillion it worked
 KILL "TEST"                        ' Don't need the file anymore