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:sa...@eightvirtues.com sa...@eightvirtues.com 
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.


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to