Benoît Minisini wrote: > > 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? >
Hi Benoît. I tried: IF NOT Exist("~/.Littoral") THEN MKDIR "~/.Littoral" Elevation = OPEN "~/.Littoral/Elevation.tmp" FOR INPUT OUTPUT CREATE SEEK #Elevation, 8590196738 WRITE #Elevation, Chr$(0) and it creates a 262,148 byte file. That's four bytes larger than a 256K file. Checking the file in a hex editor it appears that all bytes are zero except for byte 262,147, which is one. For my purposes I prefer the file to be pre-allocated so that it can be as contiguous as possible. I need to minimize read/write access times as much as possible or my app may take all day to run. The reason for such a large file is because I'm writing a terrain generation app that generates a 65,537x65,537 vertex elevation map at 1 foot per vertex resolution (12x12 miles). Each vertex uses a short, or two bytes, to represent its elevation (65,537x65,537x2). I'm using a variation of the diamond square algorithm modified by a user-supplied height field that guides the terrain generation. Ultimately the resulting data file will be stored server-side, so size isn't an object. ----- 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-tp27290885p27292087.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