textfiles.bas
来自「WEB服务器漏洞扫描器」· BAS 代码 · 共 50 行
BAS
50 行
Attribute VB_Name = "TextFiles"
Function OpenTextFile(xPath As String) As String
Dim fileNum As Integer, fileBuffer As String, tempBuffer As String
If Exists(xPath) = False Then OpenTextFile = "BAD PATH": Exit Function
fileNum = FreeFile() 'Set fileNum to available file number
Open xPath For Input As #fileNum 'Open file
Do While Not EOF(fileNum): DoEvents 'Set up read loop
Line Input #fileNum, tempBuffer 'Read data
fileBuffer = fileBuffer & tempBuffer & vbCrLf 'Concatenate
Loop
Close #fileNum 'Close file
OpenTextFile = fileBuffer 'Return contents of file
End Function
Public Function Exists(fizile As String) As Boolean
On Error Resume Next
If Dir(fizile) = "" Then
Exists = False
Else
Exists = True
End If
End Function
Function SaveTextFile(xPath As String, xData As String)
Dim fileNum As Integer
On Error GoTo Err:
fileNum = FreeFile() 'Set fileNum to available file number
Open xPath For Output As #fileNum 'Open file
Print #fileNum, xData 'Write data
Close #fileNum 'Close File
Exit Function
Err:
Exit Function
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?