[Gambas-user] Setting at zero more byte in a file by Byte[]

2012-04-08 Thread Ru Vuott
Hello, I'ld like to set at zero more subsequent byte (e.g. the FIRST four) in a file, using that code: *** Public Sub Button1_Click() Dim aFl As File Dim buff As New Byte[4] Dim b As Byte aFl = Open /tmp/my_file For Write For Each

Re: [Gambas-user] Setting at zero more byte in a file by Byte[]

2012-04-08 Thread tobi
On Sun, 08 Apr 2012, Ru Vuott wrote: Hello, I'ld like to set at zero more subsequent byte (e.g. the FIRST four) in a file, using that code: *** Public Sub Button1_Click() Dim aFl As File Dim buff As New Byte[4] Dim b As Byte aFl =

Re: [Gambas-user] Setting at zero more byte in a file by Byte[]

2012-04-08 Thread Emil Lenngren
When you write For Each b In buff b = 0 Next you get a copy of each byte in the variable 'b', not a reference. Instead, you can do something like this: For i = 0 To 3 buff[i] = 0 Next /Emil 2012/4/8 Ru Vuott vu...@yahoo.it Hello, I'ld like to set at

Re: [Gambas-user] Setting at zero more byte in a file by Byte[]

2012-04-08 Thread Ru Vuott
Hello Emil, no, it's no good, because I obtain 41 02 04 00 00 00 00 . again. Minisini's solution is that right. -- buff.Write(stream) But thank you. Bye Vuottt -- For Developers, A Lot Can Happen In A