下面是我写的读"G:\copy\boot.ini"的程序:(rootvalue(2)As string数组是我在模块里定义的,所有相关的api也声明过)
Private Sub Command3_Click()
Dim s As String, ret As Long
s = Space(1024)
ret = GetPrivateProfileString("boot loader", "default", "", s, 1024, "G:\copy\boot.ini")
If Dir("G:\copy\boot.ini") = "" Then
MsgBox "boot.ini文件不存在或已更改路径!", vbOKOnly + vbCritical, "提示"
ElseIf ret = 0 Then
MsgBox "default键值为零,读取文件出错!", vbOKOnly + vbCritical, "提示"
Else: rootvalue(0) = s
End If
s = Space(1024)
ret = GetPrivateProfileString("operating systems", rootvalue1, "", s, 1024, "G:\copy\boot.ini")
If ret = 0 Then
MsgBox "operating systems键值为零,读取文件出错!", vbOKOnly + vbCritical, "提示"
Else: rootvalue(1) = s
End If
rootvalue(1)=rootvalue(1) & "abcde"
text1.text=rootvalue(1)
End Sub
程序运行后,text1只显示"Microsoft Windows XP Professional" /execute /fastdetect并没有加上"abcde"
字符串连接应该没有错吧,具体是哪里的问题?各位帮个忙!