I want to make an application that shows me the speed of writing and reading from a pendrive.
I have written in following program, but I notice that it is very slow. Writing 10MB to drive c: takes 77 seconds.
Code: Select all
DIM AS INTEGER FileHandler, ByteCounter
DIM AS Double dt
DIM AS integer ms
Dim AS integer Size
FileHandler = FREEFILE
print "Writing 10MB to the hard drive."
print "please wait..."
OPEN "c:\file.txt" FOR BINARY AS #FileHandler
Size = 1048576 * 10
dt=Timer
FOR ByteCounter = 0 TO Size ' 1048575
PUT #FileHandler, ByteCounter, "X"
NEXT ByteCounter
dt = (Timer-dt)
'Double to integer
ms = dt
print"Time elapsed: " & ms & " secs"
CLOSE #FileHandler
Sleep
If I use a commercial program on the same computer, he writes at 20MB per second.
What is the problem with my program?
Note: I am a novice in this language. It is my first program.