Dim myStr As String
Dim myFile As Integer
Dim a() As Byte
myStr = "aaaa"
ReDim a(Len(myStr) - 1)
a() = myStr
myFile = FreeFile
Open "c:\aa.bin" For Binary As #myFile
    Put #myFile, , a
Close #myFile用UltraEdit-32 打开 aa.bin 文件却是
61 00 61 00 61 00 61 00
为什么会多"00"呢?
怎么解决?或其他的方法来写2进制文件

解决方案 »

  1.   

    Dim myStr As String
    Dim myFile As Integer
    Dim a() As Byte
    myStr = "aaaa"
    ReDim a(Len(myStr) - 1)
    a() = strconv(myStr,vbFromUnicode)
    myFile = FreeFile
    Open "c:\aa.bin" For Binary As #myFile
        Put #myFile, , a
    Close #myFile'这样是61616161
    '这样你要读出来正常显示的话,要用strconv(mystr,vbunicode)转换回来
      

  2.   

    谢谢楼上的兄弟
    还有  UltraEdit-32 打开
    怎么才能显示 "FF"??