When is a char array not a char array....?

if (tempStr[ptr] == '\n')
{
tempStr[ptr] = '\0';

Are you sure the ending is \n and not \r\n?