第1个回答 2013-02-04
想做到是没什么难度的,只是感觉毫无意义。
————————————————————
得~ 楼主执着成这样,给你一段代码:
Sub FileToChr01(SFile As String, TFile As String)
Dim B As Byte, S As String
Dim I As Integer
Open SFile For Binary Access Read As #1
Open TFile For Binary Access Write As #2
Do While Not EOF(1)
Get #1, , B
S = ""
For I = 7 To 0 Step -1
S = S & IIf((B And (2 ^ I)) > 0, "1", "0")
Next I
Put #2, , S
Loop
Close #2
Close #1
End Sub
Sub Chr01ToFile(SFile As String, TFile As String)
Dim B As Byte, N As Byte
Dim P As Integer
Open SFile For Binary Access Read As #1
Open TFile For Binary Access Write As #2
P = 0: N = 0
Do While Not EOF(1)
Get #1, , B
P = P + 1
N = N * 2 + IIf(B = Asc("1"), 1, 0)
If P = 8 Then
Put #2, , N
P = 0: N = 0
End If
Loop
Close #2
Close #1
End Sub
Private Sub Command1_Click()
FileToChr01 "C:\1.txt", "C:\2.txt"
Chr01ToFile "C:\2.txt", "C:\3.txt"
End Sub本回答被提问者采纳