VB编译错误: 要求常数表达式
Public Function GetFile(WinS As Winsock, Optional ByVal FilePath As String = App.Path + "\nn.bmp")Dim bytData() As Byte
Dim lLenFile As Long
Dim f
f = FreeFile
Open FilePath For Binary As #f 'strFileName是文件名
lLenFile = LOF(f)
ReDim bytData(1 To bytesTotal)
WinS.GetData bytData
If lLenFile = 0 Then 'lLenFile=0表示是第一次打开文件,这里有个问题,就是'如果如果该文件存在的话,就会出错,应该在打开前检查文件是否存在。(这里我省略了)
Put #f, 1, bytData
Else
Put #f, lLenFile + 1, bytData
End If
Close #f
End Function