Такой вопрос:
Как бинарного файла прочитать тип данных Date?
- Код: Выделить всё
Public Structure FileData
Dim head As Integer
Dim сount As Integer
Dim testNote As String
Dim testDate As Date 'проблема тут
End Structure
Public Function ReadFile(ByVal Path As String, <Runtime.InteropServices.Out()> ByRef File As FileData) As Boolean
Dim ret As New FileData
If IO.File.Exists(Path) Then 'проверяем файл на существование
Try
Using fs As New IO.FileStream(Path, IO.FileMode.Open, IO.FileAccess.Read)
Dim br As New IO.BinaryReader(fs)
With ret
.head = br.ReadInt32
.сount = br.ReadInt32
.testNote = System.Text.ASCIIEncoding.Default.GetString(br.ReadBytes(16))
File = ret
Return True
End With
fs.Close()
End Using
Catch
'MsgBox(Err.Number)
Return False
End Try
Else
Return False
End If
End Function
Спасибо!