> 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 >
On Linux, If you seek and write past the real end of a file, then the file is automatically extended. So the simplest is writing where you want in the file only when you need. Just don't do that randomly, to prevent the disk from seeking too much. Most Linux file systems will reserve only pieces where something was written. The other part of the file that are only zeros are virtual, and will not consume your hard disk. Anyway, why do you need 8Gb of data at once? -- Benoît Minisini ------------------------------------------------------------------------------ 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