I don't know what you mean by "I cannot read a text file line with the
FileStream class." You can't use a method that reads each line, no, but you
can certainly identify line breaks. So, yes, you have to do a bit more work
in terms of your code, breaking the lines yourself.
Here's the deal: If you use a StreamReader/TextReader to read the file, you
can only move forward. To go backward, you would have to close and re-open
the StreamReader. That is going to be time-consuming, in terms of
performance. If you use a FileStream you have random access to the file, but
you have to manage the data you read in your code. The buffer that you read
into is just a temporary storage container, which you can re-use throughout
the lifetime of the FileStream. So, you can identify line breaks and build
your own strings from the data you read.
--
HTH,
Kevin Spencer
Microsoft MVP
Short Order Coder
http://unclechutney.blogspot.com
The devil is in the yada yada yada
<in**@devdept.c omwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Kevin,
I cannot read a text file line with the FileStream class. The Read
method wants to know before reading how many bytes to read...
I need the StremReader.Rea dLine method...
How can I proceed?
Thanks again,
Alberto