Lee Crabtree

Is there a StreamReader-like class that will let me read lines of text from a file without buffering I ask because I need to be know the position in the file of the line being read, and since StreamReader buffers data, reading the BaseStream.Position property doesn't report the right offset into the file.

I know I could derive my own class and get it all to work, but if there's something that already exists, I'd rather use that than write and debug my own. If there isn't, then is there some reason for it's exclusion


Re: .NET Base Class Library unbuffered stream?


Nope. StreamReader needs a buffer to be able to supply up to 4 bytes of a UTF8 character to the decoder. The buffer position, bytePos, is a private member. You'll need to read the file with FileStream, find the line endings and convert the bytes in between yourself. I assume you've already got something like that.

Re: .NET Base Class Library unbuffered stream?


The Microsoft.Visual.Basic.FileIO FileSystem class would probably do what you want, but it is recommended that it not be used.