Comparing two files

I am comparing two files by reading them into filestream and comparing byte by byte. How can I skip spaces during comparison? I am using C # .net

+2


source to share


1 answer


byte b;  

// ....

if (Char.IsWhiteSpace((char) b))
{
   // skip...
}

      



EDIT . As Eric Lippert points out, this is only true if the file's encoding is plain 7-bit ASCII. In any other encoding, it skips the corresponding bytes. So you have to consider the encoding of your data.

+3


source







All Articles