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
For looking at the next character you can use the method Peek.
This will return the next character without changing your location in the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With