1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Try
'Test si le fichier existe
If Not File.Exists(FileName.NomFichierComplet) Then
File.Create(FileName.NomFichierComplet)
Header = FileName.NomFichier & vbCrLf
Header = Header & Format(Now, "dd-mm-yyyy").ToString & vbCrLf
newFile = True
End If
Sw = New StreamWriter(FileName.NomFichierComplet, True)
If newFile Then Sw.WriteLine(Header)
Dim NumBit As Integer = AdrBase
Dim BitValue As Byte = 0
For i As Integer = 0 To DataBits.Length - 1
BitValue = DataBits(i)
For BitPos As Integer = 0 To 7
LigneCSV = "%M" & NumBit & ";" & Str(BitValue And 1)
BitValue = BitValue >> 1
Sw.WriteLine(LigneCSV)
NumBit = NumBit + 1
If NumBit >= NbrBits Then Exit For
Next
Next
Catch ex As Exception
'Gestion des erreurs
Finally
Sw.Close()
End Try |
Partager