N
nevin
Hi,
I have a text file of about 12k long. I'm reading the first part of the
file with a readline() and it works ok.
Then in a different function (same open stream) I want to move to the
bottom of the file and retrieve the very last bit of text minus the
trailing spaces.
I'm doing something like:
// move to 200 chars from the end of the stream;
sr.BaseStream.Seek(-200, SeekOrigin.End);
// get the remains of the file
string numrecs = sr.ReadToEnd();
// do some work on the string (remove spaces and some other stuff)
This should move the position of the stream in the file and in the
debugger I can see the position is updated correctly. But when I read
from what should be 200 chars from the end, it reads about 630 chars
from where the ReadLine()'s left off.
So, not only is it not reading from where I want it, ReadToEnd() is not
even doing what it should as from the point it's reading there are qute
a few thousand chars to the end of the file and it's only reading about
630.
Any clues appreciated
Nev
I have a text file of about 12k long. I'm reading the first part of the
file with a readline() and it works ok.
Then in a different function (same open stream) I want to move to the
bottom of the file and retrieve the very last bit of text minus the
trailing spaces.
I'm doing something like:
// move to 200 chars from the end of the stream;
sr.BaseStream.Seek(-200, SeekOrigin.End);
// get the remains of the file
string numrecs = sr.ReadToEnd();
// do some work on the string (remove spaces and some other stuff)
This should move the position of the stream in the file and in the
debugger I can see the position is updated correctly. But when I read
from what should be 200 chars from the end, it reads about 630 chars
from where the ReadLine()'s left off.
So, not only is it not reading from where I want it, ReadToEnd() is not
even doing what it should as from the point it's reading there are qute
a few thousand chars to the end of the file and it's only reading about
630.
Any clues appreciated
Nev