In the original example is tested:if (inChar == '\ n') ....so, i think is correct what i said
We could argue for months about whether the newline should be considered "part of the string received."But WHY "-2"?? Are you assuming that any line terminated by a newline is terminated by "\r\n"? That's not a safe assumption!