How did you "delete" the \n\0. If you somehow "remove" the \0, you no longer have a valid string, since a string in C must end with a \0. All you really need to do is find the \n and replace it...