'将文本文件整个读到Byte数组:
Dim tBytes() As Byte
tFN=FreeFile
Open pFileName For Binary As #tFN
tFileSize=LOF(#tFN)
ReDim tBytes(tFileSize-1)
Get #tFN,1,tBytes()
Close #tFN
tString=StrConv(tBytes(),vbUnicode) '从文件获得数组转换为带换行的多行文本字符串。
反之,如果将字符串文本写为二进制文件,则要:
Dim tBytes() As Byte
tBytes()=StrConv(tString,vbFormUnicode)
tFN=FreeFile
Open pFileName For Output As #tFN '清除文件内容
Close #tFN
Open pFileName For Binary As #tFN
Put #tFN,1,tBytes()
Close #tFN