Or you can just trim off the end spaces.
int str_rtrim(STRING* input)
{ int trunc, pos; for(pos=str_len(input)-1; pos>0; pos--)
{ if((input.chars)[pos]!=32)
{ str_trunc(input, (trunc=str_len(input)-pos-1));
break;
} }
return(trunc);
}
This function trims off any trailing spaces (on the right-hand end of the string),
and it returns the number of trimmed spaces if you want to know...