Is there any way to compare two txt files starting from 2 line (or nth line)? I have tried to search online but unable to find any way
I have got many examples to compare two files but all examples are related to entire files.
Right now I am using following code
private static bool FileCompare(string file1, string file2)
{
int file1byte;
int file2byte;
FileStream fs1;
FileStream fs2;
if (file1 == file2)
{
return true;
}
fs1 = new FileStream(file1, FileMode.Open, FileAccess.Read);
fs2 = new FileStream(file2, FileMode.Open, FileAccess.Read);
if (fs1.Length != fs2.Length)
{
fs1.Close();
fs2.Close();
return false;
}
do
{
file1byte = fs1.ReadByte();
file2byte = fs2.ReadByte();
}
while ((file1byte == file2byte) && (file1byte != -1));
fs1.Close();
fs2.Close();
return ((file1byte - file2byte) == 0);
}