I am trying to open for reading a Windows file (used in XP through 7) for reading. However, even though I provide a complete location ("C:\Windows\system32\config\default"), I get a file not found exception.
The file's only unusual attribute is "A" (archive?). My code, shown below, gets the exception at this line, when I try to open it:
logFileStream = New FileStream("C:\Windows\system32\config\default", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Can anyone tell me how to access this file?
Thanks, Alan
Dim logFileStream As System.IO.FileStream, logFileReader As System.IO.StreamReader, line As String
logFileStream = New FileStream("C:\Windows\system32\config\default", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
logFileReader = New StreamReader(logFileStream)
While (Not logFileReader.EndOfStream)
line = logFileReader.ReadLine()
Debug.Print(line)
TextBox1.Text = TextBox1.Text & line & vbCrLf
End While
logFileReader.Close()
logFileStream.Close()
The file's only unusual attribute is "A" (archive?). My code, shown below, gets the exception at this line, when I try to open it:
logFileStream = New FileStream("C:\Windows\system32\config\default", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Can anyone tell me how to access this file?
Thanks, Alan
Dim logFileStream As System.IO.FileStream, logFileReader As System.IO.StreamReader, line As String
logFileStream = New FileStream("C:\Windows\system32\config\default", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
logFileReader = New StreamReader(logFileStream)
While (Not logFileReader.EndOfStream)
line = logFileReader.ReadLine()
Debug.Print(line)
TextBox1.Text = TextBox1.Text & line & vbCrLf
End While
logFileReader.Close()
logFileStream.Close()