private Sub Savelog As Boolean
If sd.OpenReadWrite("/log.dat") = True Then
sd.Position = sd.CurrentFile.Size
For i = 0 To 4
Dim buff(10) As Byte
Dim sI As String = NumberFormat (i,10,0)
Dim b1(sI.GetBytes.Length) As Byte
b1 = BC.StringToBytes(sI)
BC.ArrayCopy(b1, buff)
sd.Stream.WriteBytes(buff,0,buff.Length)
Dim b2(";".GetBytes.Length) As Byte
b2 = BC.StringToBytes(";")
BC.ArrayCopy(b2, buff)
sd.Stream.WriteBytes(buff,0,buff.Length)
Dim b3("Column_".GetBytes.Length) As Byte
b3 = BC.StringToBytes("Column_")
BC.ArrayCopy(b3, buff)
sd.Stream.WriteBytes(buff,0,buff.Length)
Dim sC As String = NumberFormat(i, 2, 0)
Dim b4(sC.GetBytes.Length) As Byte
b4 = BC.StringToBytes(sC)
BC.ArrayCopy(b4, buff)
sd.Stream.WriteBytes(buff,0,buff.Length)
BC.ArrayCopy(b2, buff)
sd.Stream.WriteBytes(buff,0,buff.Length)
Dim sCRLF As String = CRLF
Dim b5(sCRLF.GetBytes.Length) As Byte
b5 = BC.StringToBytes(sCRLF)
BC.ArrayCopy(b5, buff)
sd.Stream.WriteBytes(buff,0,buff.Length)
Next
sd.Close
Log("Saved to file OK")
Return True
Else
Log("SD card writing error")
Return False
End If
End Sub