刚才玩了下游戏没有看到。。。恩,睡觉了。
思路是前面怎么变不管了,后面格式占位固定,
那么它应该是倒数第59位。。。你的数据没有体现
出来,我也不知道对不对。你先试验下吧。
Example3.vbs:
Const ForReading = 1 '设定打开文本方式为读取
Const ForWriting = 2 '设定打开文本方式为写入
Const ForAppending = 8 '设定打开文本方式为追加
Const InFile = "a.txt" '设定打开的文本
Dim i,Sum
Dim StrLine,OutStr1,OutStr2
i = 1:Sum = 0
'On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject") '引用FSO对象,读写文件要用到的
Set objFile = objFSO.OpenTextFile(InFile, ForReading) '以读取方式打开InFile
Do Until objFile.AtEndOfStream
StrLine = objFile.ReadLine '读取一行
If Len(StrLine) Then '如果不是空行
'MsgBox Mid(StrLine,Len(StrLine) - 58,1) 测试用的(已注释掉)。
If Mid(StrLine,Len(StrLine) - 58,1) = "1" Then '倒数应该对的吧?
OutStr1 = OutStr1 & StrLine & vbCrLf
Else
OutStr2 = OutStr2 & StrLine & vbCrLf
End If
End If
Loop
objFile.Close '关闭文件对象
Set objFile = objFSO.OpenTextFile("a1.txt", ForWriting,True)
objFile.Write OutStr1
objFile.Close
Set objFile = objFSO.OpenTextFile("a2.txt", ForWriting,True)
objFile.Write OutStr2
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
Last edited by slore on 2008-2-2 at 02:13 AM ]