tags:

views:

80

answers:

0

Hello,

I have some difficulties with stream. I am using FileStream and BinaryReader and I got some seird behaviours. First of all (and this was on another question, when used StreamReader I got weird behaviour that when I did Peek the psoition was changed, so I used BinaryReader which was fine) NOW I have a problem that sometimes when I do Seek (using ofcourse the underlying base stream - FileStream) SOMETIMES it works fine (get to the right position) but sometimes it just jumps to a position that is way beyond the file's length, It doesn't happen all the time, forinstance I had a problem to get to a psoition at 1233*267, but a day later it was fine and the problem was on another place.

FileStream m_fsReader = new FileStream(m_strDataFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); BinaryReader m_brReader = new BinaryReader(m_fsReader);

and the seek part: m_fsReader.Seek(offset, SeekOrigin.Begin);

Thanks,