|
发表于 2009-2-14 04:44:07
|
显示全部楼层
Global $Line_Counter = 0
Global $File_Name = ""
Global $File_Read_Handler = FileOpen("filename", 0) ; read mode
Global $File_Write_Handler
If $File_Read_Handler = -1 Then
MsgBox(0, "Error", "不能打开文件")
Exit
EndIf
While 1
$File_Read_Line = FileReadLine($File_Read_Handler)
If @error = -1 Then ExitLoop
If $Line_Counter = 0 Then
$File_Name = $File_Read_Line ; 如果当前读第一行,将其保存为文件名
$File_Write_Handler = FileOpen($File_Name & ".txt", 2)
If $File_Write_Handler = -1 Then
MsgBox(0, "Error", "不能打开文件")
Exit
EndIf
FileWriteLine($File_Write_Handler, $File_Name)
Else
FileWriteLine($File_Write_Handler, $File_Name)
$Line_Counter += 1
If $Line_Counter = 50 Then
$Line_Counter = 0 ; reset counter for every 50 lines
FileClose($File_Write_Handler) ; close file wrinting handler
EndIf
EndIf
Wend
FileClose($File_Read_Line)
[ 本帖最后由 xinlu8439 于 2009-2-14 04:46 编辑 ] |
|