I am reading huge textfile (1.8 GB) with
while ((j = file.ReadLine()) != null) {...}
However, after some operations i got myself into situation, when I would like to ‘undo’ last ReadLine, so the next ReadLine would actually read exactly the same line.
Is there any way to do it? 🙂
The same job would do ‘looking at next character’ without any reading, so that I could, based on this character, decide if I want to read next line or not.
example:
>1
abc
def
>2
ghi
After I read ‘def’ with ReadLine() I want to know if the next line contains ‘>’ character or if there are just letters of alphabet.
Thanks a lot.
For just ‘looking at next character’, use the Peek() method:
http://msdn.microsoft.com/en-us/library/system.io.streamreader.peek(v=VS.100).aspx