[Gambas-user] fastest way to "zero-out" a huge binary file
kevinfishburne
kevinfishburne at ...1887...
Sun Jan 24 00:16:03 CET 2010
I need to create an 8 gigabyte binary file with zero values throughout it. Is
there a faster way to do this than to create a big string of zeros and write
it to the file multiple times? What I'm doing right now works but seems like
a really ugly method:
' Zero-out the file.
Zero = Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) &
Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) &
Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) &
Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) &
Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0)
FOR counter = 1 TO 65536
Zeros = Zeros & Zero
NEXT
FOR counter = 1 TO 4096
WRITE #Elevation, Zeros
NEXT
-----
Kevin Fishburne, Eight Virtues
www: http://sales.eightvirtues.com http://sales.eightvirtues.com
e-mail: mailto:sales at ...1887... sales at ...1887...
phone: (770) 853-6271
--
View this message in context: http://old.nabble.com/fastest-way-to-%22zero-out%22-a-huge-binary-file-tp27290885p27290885.html
Sent from the gambas-user mailing list archive at Nabble.com.
More information about the User
mailing list