N
Nevin
Hello,
I have a text file of about 12k which I read the first 5 lines using a
StreamReader.ReadLine() in a loop, all ok.
The reader is passed to another function to read the last piece of text in
the file and this is where it's going wrong. I'm doing something like:
sr.BaseStream.Seek(-200, SeekOrigin.End);
// get the remains of the file
string n = sr.ReadToEnd();
But while I see the base streams position moving exactly where it should,
the subsequent ReadToEnd() reads from where the previous methods
ReadLine()'s left off.
Not only that but the ReadToEnd() should only read 200 chars as the
position should be 200 from the end but it reads in 630 chars from 5 lines
into the file (which isn't to then end of the file either).
This is mega simple stuff and I'm not sure why it's not working.
I have a text file of about 12k which I read the first 5 lines using a
StreamReader.ReadLine() in a loop, all ok.
The reader is passed to another function to read the last piece of text in
the file and this is where it's going wrong. I'm doing something like:
sr.BaseStream.Seek(-200, SeekOrigin.End);
// get the remains of the file
string n = sr.ReadToEnd();
But while I see the base streams position moving exactly where it should,
the subsequent ReadToEnd() reads from where the previous methods
ReadLine()'s left off.
Not only that but the ReadToEnd() should only read 200 chars as the
position should be 200 from the end but it reads in 630 chars from 5 lines
into the file (which isn't to then end of the file either).
This is mega simple stuff and I'm not sure why it's not working.