VB6结构体
Public Type TypeResult
KensaDate(1 To 2) As Date
RecipeNo As Integer
RecipeName As String
GlassCF As String
GLASSTFT As String
VASNo As Byte
VASX As Single
VASY As Single
VASC As Single
Paneljieguo(1 To 50, 1 To 4, 1 To 2) As String '50个单元,每个单元4个点位,1=X,2=Y
YouxiaoMarkCnt As Integer
End Type
Public HistoryResult As TypeResult '20240104
VB6读取文件内容代码:
Option Explicit
Private Sub Command1_Click()
Dim fno As Integer
Dim ret&
Dim fs
Dim vFileName As String
vFileName = "D:/HistoryData/Result/20241029/R0000000100"
ret = 0
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(vFileName) = False Then
ret = -1
Else
fno = FreeFile
Open vFileName For Binary Access Read As fno
Get fno, , HistoryResult
Close fno
End If
End Sub
这段代码是VB6写的用来将一个二进制文件内容转换成结构体,VB6能够正常读取所有字段的值,不需要任何特殊处理,现在遇到的问题是,使用C#去读取相同的文件,读取的内容就有问题,在RecipeName以下的值都是不正常的。
我这边可以提供二进制文件,若谁可以解决另有酬谢
AI回答一律忽视,我这边自己也有AI,我自己不会问吗?