C Delete the new line character from the end of a string