You need to access content at a specific byte position in a file.
Use the Seek() method of a stream to relocate the current position of the stream:
Dim oneByte As Byte Dim fileData As New IO. FileStream(filePath, _ IO.FileMode.Open, IO.FileAccess.Read) ' ----- Jump to byte 1000 and read what's there. fileData.Seek(1000, IO.SeekOrigin.Begin) oneByte = fileData.ReadByte( )
The Seek() method lets you quickly adjust your position in the file. The second argument specifies how the movement is to occur using one of the System.IO.SeekOrigin enumeration values:
If you position the current position past the end of the file, the next data you write to the file will fill in all the unwritten space between the current end of the file and your new data. If you attempt to read past the end of the file, an exception occurs. You cannot set the current position to a place before the beginning byte of a file.
To determine the current byte position, access the stream's Position property.