The "line.separator" property just tells you what the operating system thinks is a line break; it doesn't tell you anything about the file you're reading. To detect line breaks in a platform-neutral way, you have to look for '\n', '\r', or the two-character sequence "\r\n".
BTW, there's no need to convert the char to a
string to do these tests, just do
if (c == '\r') and
if (c == '\n').