注册 登录
编程论坛 VB6论坛

读取文件内容本地验证

randy01 发布于 2023-10-18 18:16, 840 次点击
读取文件内容一串数字,本地验证,验证成功可通过,失败则结束自身进程
1 回复
#2
yiyanxiyin2023-10-19 16:51
'读取文本文件
Function GetFile(FileName As String) As String
Dim i As Integer, s As String, BB() As Byte
If Dir(FileName) = "" Then Exit Function
i = FreeFile
ReDim BB(FileLen(FileName) - 1)
Open FileName For Binary As #i
Get #i, , BB
Close #i
s = StrConv(BB, vbUnicode)
GetFile = s
End Function

'调用举例:
dim s as string
s=GetFile("c:\1.txt")
1