本帖最后由 C.L 于 2010-1-15 23:46 编辑
我的笨办法:Dim $afile1[1], $afile2[1]
WriteFile("1.txt", "2.txt")
Func ReadFile1ToArray($file)
$file1 = FileOpen($file, 0)
$i = 0
While 1
$line = FileReadLine($file1)
If @error Then
FileClose($file1)
ExitLoop
EndIf
If $line Then
$afile1[$i] = $line
$i += 1
ReDim $afile1[UBound($afile1) + 1]
EndIf
WEnd
ReDim $afile1[UBound($afile1) - 1]
EndFunc ;==>ReadFile1ToArray
Func ReadFile2ToArray($file)
$file2 = FileOpen($file, 0)
$i = 0
While 1
$line = FileReadLine($file2)
If @error Then
FileClose($file2)
ExitLoop
EndIf
If $line Then
$afile2[$i] = $line
$i += 1
ReDim $afile2[UBound($afile2) + 1]
EndIf
WEnd
ReDim $afile2[UBound($afile2) - 1]
EndFunc ;==>ReadFile2ToArray
Func WriteFile($read, $write)
ReadFile1ToArray($read)
ReadFile2ToArray($write)
$file3 = FileOpen($write, 1)
For $i = 0 To UBound($afile1) - 1
$flag = 1
For $j = 0 To UBound($afile2) - 1
If $afile1[$i] == $afile2[$j] Then
$flag = 0
ExitLoop
EndIf
Next
If $flag Then FileWriteLine($file3, $afile1[$i])
Next
FileClose($file3)
ShellExecute($write)
EndFunc ;==>WriteFile
|