读取文本内容

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <String.au3>

    ; Open the file for reading and store the handle to a variable.
    Local $hFileOpen = FileOpen("log.txt")
    If $hFileOpen = -1 Then
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.")
        Return False
    EndIf

    ; Read the contents of the file using the handle returned by FileOpen.
    Local $sFileRead = FileRead($hFileOpen)

    ; Close the handle returned by FileOpen.
    FileClose($hFileOpen)

    ; Display the contents of the file.
   ; MsgBox($MB_SYSTEMMODAL, "", $sFileRead)

posted @ 2022-06-29 15:14  江南王小帅  阅读(45)  评论(0)    收藏  举报