Ernst Sauer
unread,Sep 6, 2012, 5:07:20 AM9/6/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hello,
I want (for example) to read a certain line again,
so I thought this should work:
StreamReader sr;
sr = new StreamReader(rfile)
string line;
long pos;
int i=0;
while (i++<3)
{ if (i==2) pos=sr.BaseStream.Position;
line=sr.ReadLine();
sr.DiscardBufferedData(); // no success with and witout
}
sr.BaseStream.Seek(pos, SeekOrigin.Begin);
I have a small test-file.
With the first ReadLine() sr reads the whole file
(later he splits the lines)
and sets the pos to the end of the stream.
With sr.DiscardBufferedData() I can't even read the second line.
Of course I can write my own method, but is this really necessary?
Thanks
E.S.