Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-25 Thread Olivier Cruilles
Hi, It's possible to create a file with only zero inside simply by this command if you want: dd if=/dev/zero of=file_to_create bs=1k count=8388608 Olivier Cruilles Mail: linu...@club-internet.fr Le 25 janv. 2010 à 10:47, Doriano Blengino a écrit : > > Doriano Blengino ha scritto: >> >> The

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-25 Thread Simonart Dominique
Hi, May be I've to elaborate a little bit? I see the process like this: 1) you transpose each cell of your initial array to a pixel of a picture where the coordinates of the pixel is equal to the coordinate of the cell and the grey color of the pixel is equal to the elevation in the cell 2) yo

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-25 Thread Doriano Blengino
Doriano Blengino ha scritto: > > The subroutine could look something like this: > > sub square_diamond(left, right, top, bottom as integer) > > step = (right+left) / 2 > SORRY: step = (right - left) / 2 Urgh... Regards, Doriano

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-25 Thread Doriano Blengino
kevinfishburne ha scritto: > Doriano Blengino wrote: > >> Read carefully the documentation about the WRITE instruction - in the >> first few lines you find the explanation. When you write something out, >> you can specify the length of the data you write. If you don't specify >> it, gambas wi

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-24 Thread Simonart Dominique
Hi, I've just a crude idea and know nothing more on this subject! If you assume that each value in your big array is a color value instead of an integer, may be you can find some graphic effect wich simulate your algorithm. It seems to me that it's like to find an intermediate color between 2 ot

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-24 Thread kevinfishburne
Doriano Blengino wrote: > > Read carefully the documentation about the WRITE instruction - in the > first few lines you find the explanation. When you write something out, > you can specify the length of the data you write. If you don't specify > it, gambas will do it for you, and this is wha

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-24 Thread Benoît Minisini
> Public Sub Button1_Click() > > Dim hFile As File > Dim LastChar As Byte > > hFile = Open bigfile For Input > > ' Should get 3930677248 > Debug Lof(hFile) > > Seek #hFile, 3930677241 > > ' Should get 3930677241 > Debug Seek(hFile) > > Read #hFile, LastChar > --> Beware! T

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-24 Thread Doriano Blengino
kevinfishburne ha scritto: > Kadaitcha Man wrote: > >> Have you tried using a Long instead of an Integer? >> >> >> >> :) >> >> > > Haha, that gave me a good laugh. When I discovered the "bug" was just me > being a jackass I practically did the Snoopy dance I was so overjoyed. > Simple prob

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread kevinfishburne
Kadaitcha Man wrote: > > Have you tried using a Long instead of an Integer? > > > > :) > Haha, that gave me a good laugh. When I discovered the "bug" was just me being a jackass I practically did the Snoopy dance I was so overjoyed. Simple problems are always the best once you finally figur

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread Kadaitcha Man
On 24 January 2010 16:08, kevinfishburne wrote: > Praise God, I was incorrect. I was foolishly using too small a datatype > (integer) when calculating the seek position. Now that I switched it to long > all is well. :) Have you tried using a Long instead of an Integer? :) ---

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread Kadaitcha Man
On 24 January 2010 16:02, kevinfishburne wrote: > Excellent, thanks. I seem to have found something horrifying while trying to > create the file using GAMBAS however; using the SEEK statement with an > argument greater than 2 GB raises a "Bad argument" error. While that doesn't > affect my abilit

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread kevinfishburne
kevinfishburne wrote: > > Excellent, thanks. I seem to have found something horrifying while trying > to create the file using GAMBAS however; using the SEEK statement with an > argument greater than 2 GB raises a "Bad argument" error. While that > doesn't affect my ability to create the file, i

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread kevinfishburne
Kadaitcha Man wrote: > > In a terminal, type: > > info coreutils 'dd' > > You only need create the file once, then copy it whenever you need to > during testing. If you really must create the file every time, let dd > do it by using Gambas' Exec command. > Excellent, thanks. I seem to have f

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread nando
65537 This is the absolute fastest way to do it. -Fernando -- Original Message --- From: kevinfishburne To: gambas-user@lists.sourceforge.net Sent: Sat, 23 Jan 2010 19:21:33 -0800 (PST) Subject: Re: [Gambas-user] fastest way to "zero-out" a huge binary file > Ben

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread Kadaitcha Man
On 24 January 2010 14:21, kevinfishburne wrote: In a terminal, type: info coreutils 'dd' You only need create the file once, then copy it whenever you need to during testing. If you really must create the file every time, let dd do it by using Gambas' Exec command. HTH ---

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread kevinfishburne
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. > > M

Re: [Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread Benoît Minisini
> 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 =

[Gambas-user] fastest way to "zero-out" a huge binary file

2010-01-23 Thread kevinfishburne
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$(