I am getting error 70 intermittently while running my VB6 Exe application.
I try to open a te开发者_JS百科xt file as given under from a class function. The text is on the filer (network file server)
I tried to delay on catching the error 70. Later on close the file and re-open. But that didn't work either.
Code:
If FreeFile > 1 Then
Close #1
End If
Open FileName1 For Append As #1 (I am getting Error 70)
Print #1, StringOut
Print #1, ""
Print #1, ""
Print #1, ""
Close #1
Open FileName2 For Append As #2
Print #2, StringOut
Close #2
Close
You should be using the value returned by the free file function, so a slight change is in order.
Dim File1Number As Integer
Dim File2Number As Integer
File1Number = FreeFile
Open FileName1 For Append As #File1Number (I am getting Error 70)
Print #File1Number , StringOut
Print #File1Number , ""
Print #File1Number , ""
Print #File1Number , ""
Close #File1Number
File2Number = FreeFile
Open FileName2 For Append As #File2Number
Print #File2Number, StringOut
Close #File2Number
Close #File2Number
Error 70 is "Permission denied."
Can you open that file with notepad, change it, and save it? If not, solve that problem first, then look at your code.
精彩评论