本帖最后由 afan 于 2012-12-1 22:15 编辑 Local $file = FileOpen('test.txt', 0), $sDelimiter = '*'
If $file = -1 Then Exit MsgBox(0, '错误', '不能打开文件.')
HotKeySet('{esc}', '_Exit')
Local $line, $location, $iL = 0, $sA = '', $sB = ''
While 1
$iL += 1
$line = FileReadLine($file, $iL)
If @error = -1 Then $iL = 0
$location = StringInStr($line, $sDelimiter)
If Not $location Then ContinueLoop
$sA = StringMid($line, 1, $location - 1)
$sB = StringMid($line, $location + 1)
MsgBox(0, '以 "' & $sDelimiter & '" 分割行 ' & $iL, $sA & @LF & $sB)
WEnd
Func _Exit()
Exit FileClose($file)
EndFunc ;==>_Exit
|