G
Guest
I'm using a StreamReader to read in several lines from an ASCII file. I'd
like to know the StreamReader's "true" position-- that is, the number of
bytes into the file that the StreamReader has read. I thought about using
MyStreamReader.BaseStream.Position, but this always seems to return a
multiple of the StreamReader's buffer size (which seems natural-- as I
understand it the StreamReader reads from the underlying stream in discrete
blocks corresponding to the buffer size). I also considered counting the
bytes myself (as I read into the file), but ReadLine() doesn't record whether
the returned line ended in a CR, an LR, or both.
Any ideas?
Thanks,
Keith Kingsley
like to know the StreamReader's "true" position-- that is, the number of
bytes into the file that the StreamReader has read. I thought about using
MyStreamReader.BaseStream.Position, but this always seems to return a
multiple of the StreamReader's buffer size (which seems natural-- as I
understand it the StreamReader reads from the underlying stream in discrete
blocks corresponding to the buffer size). I also considered counting the
bytes myself (as I read into the file), but ReadLine() doesn't record whether
the returned line ended in a CR, an LR, or both.
Any ideas?
Thanks,
Keith Kingsley