As I mentioned, you must implement your own ReadLine method.
This is a simple implementation. Not tested, and four sure, not the best implementation.
public bool SearchText(string fileName, string textToFind) { var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); string line=""; while(line!="ERROR") { line=ReadLine(fs); if(line==textToFind) { fs.Close(); return true; } } fs.Close(); return false; } private static string Readline(FileStream fs) { try { byte[] buffer = new byte[1024]; byte b = 0; byte r = 0; int l = 1024; for (int n = 0; n < 1024; n++) { b = (byte)fs.ReadByte(); if (b == 13) { r = (byte)fs.ReadByte(); if (r == 10) { l = n; break; } else { buffer[n] = b; n++; } } bufer[n] = b; } string line = new string(Encoding.UTF8.GetChars(buffer, 0, l)); return line; } catch { return "ERROR"; } }
Hope it helps!