modunixinfo.bas
来自「这是书上的代码」· BAS 代码 · 共 44 行
BAS
44 行
Attribute VB_Name = "modUnixInfo"
Public strIP As String 'UNIX主机IP地址
Public strUserName As String '登录用户名
Public strPassword As String '登录密码
'---------------------
Public Const InfoFile = "\sys.dat"
'===========| 获取UNIX主机信息 |==========
Public Function GetUnixInfo() As Boolean
Dim lngF As Long
lngF = FreeFile
On Error GoTo GET_ERR
Open App.Path + InfoFile For Input Access Read As #lngF
Input #lngF, strIP
Input #lngF, strUserName
Input #lngF, strPassword
Close #lngF
GetUnixInfo = True
Exit Function
GET_ERR:
GetUnixInfo = False
End Function
'===========| 设置UNIX主机信息 |==========
Public Sub SetUnixInfo()
Dim lngF As Long
lngF = FreeFile
On Error GoTo SET_ERR
Open App.Path + InfoFile For Output Access Write As #lngF
Print #lngF, strIP
Print #lngF, strUserName
Print #lngF, strPassword
Close #lngF
Exit Sub
SET_ERR:
MsgBox "写入UNIX信息文件错!", 16
End Sub
'===========| UNIX主机信息变量初始化 |==========
Public Sub InitUnixInfo()
strIP = ""
strUserName = ""
strPassword = ""
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?