As it stands I can currently compare byte for byte:
byte b0 = (byte)num9; //get single byte value from volume. num9 = short
//loop through remaining bytes until we find value *should* be the only occurance eek.
do
{
binaryReader.ReadByte();
}
while (binaryReader.ReadByte() != b0);While this kinda works it doesn't always return what I expect. If I use binaryReader.ReadInt16() then I will miss possible matches.
Ideally I dont want to read the bytes into the array,find the index and move the base stream position...I really want to check each possible short value in the remaining bytes...
The way I see it is something like this (on the basis that a short is 2 bytes):
byte1
byte2
byte3
byte4
byte5
[byte1, byte2]...[byte2, byte3]...[byte3, byte4]...[byte4, byte5]
Any help would be great..I just can't seem to visualise what to do.

VulpesRank #55 · 29.2K reputationPosted Mar 13, 2014, 2:13 PM EDT
When you say 'short' I assume you mean a signed 2 byte integer and not a 'ushort':
Jay S159 reputationPosted Mar 14, 2014, 1:01 AM EDT
EDIT:
I ended up using a break; as part of the If statement...not sure if this is the most efficent way..
VulpesRank #55 · 29.2K reputationPosted Mar 14, 2014, 1:39 AM EDT
if (s == value) break;
to exit the while loop when the first match is detected.
The BaseStream position will then, of course, be on the second byte of the short.