刷新缓冲区文件到磁盘.
FileFlush ( 句柄 )
句柄 | 先前调用 FileOpen() 函数返回的文件句柄. |
成功: | 返回 true, 缓冲区已刷新 (或不需要刷新). |
失败: | 返回 false. |
Local Const
$sFile =
"test.txt"
Local $hFile
= FileOpen($sFile, 1)
; 检查文件是否为写模式打开
If $hFile
= -1 Then
MsgBox(0, "错误", "无法打开文件.")
Exit
EndIf
; 写一些东西到文件.
FileWriteLine($hFile, "一行文本")
; 运行记事本程序, 显示该文件是空的, 因为它没有刷新.
RunWait("notepad.exe " & $sFile)
; 刷新文件到磁盘.
FileFlush($hFile)
; 再次运行记事本程序,表明该文件的内容现在已刷新到磁盘.
RunWait("notepad.exe " & $sFile)
; 关闭句柄.
FileClose($hFile)
; 清理临时文件.
FileDelete($sFile)
provider with jb51.net (unicode) |