void strip_newline( char *str, int size ) { int i; /* remove the null terminator */ for ( i = 0; i < size; ++i ) { if ( str[i] == '\n' ) { str[i] = '\0'; return; } } }