[Tutor] C program

Alan Gauld alan.gauld at btinternet.com
Wed Aug 1 06:42:21 CEST 2007


"Tiger12506" <keridee at jayco.net> wrote

> I have a string with space and I would like to remove the space 
> before
> comparing but I don't know how to go about doing it. Here is the 
> code

Look at strrchr()...

> void rstrip(char *c) {
>  while (*c++!=0);
>  c--;
>  while (*--c==' ') *c = 0;
> }

Or roll your own... :-)
This is probably easiest if you only want to catch spaces...

Alan G. 




More information about the Tutor mailing list