Search code examples
c#fileio

Moving through a Filestream line by line (without using StreamReader) (Visual C#)


I have a file and I have to skip 4 lines from it then skip 2 bytes problem is if i use StreamReader, I can't move 2 bytes since there's no read by byte.. If i use FileStream i can't move through it line by line

I tried to read line by line using StreamReader and then get the stream using BaseStream property and move up 2 bytes but when I get the BaseStream, the position is back at the front of the file..

Can anyone help out?


Solution

  • Can you just read byte by byte with the FileStream and count the newlines?