On Sun, 26 Nov 1995 myers@indy.net wrote:
> > you don't need to return anything... do the string in place:
> >
> > [........................ snip .........................]
> >
> > void remove_CRs(char *string)
> > {
> > register char *ptr;
> >
> > ptr = string;
> > do {
> > if (*string != '\r')
> > *ptr++ == *string;
> ^^
>
> > ++string;
> > } while(*string);
> > }
> >
> > [......................... snip .........................]
> >
> > this does it all, including placing the endmark on the string. it's also
> > compact and FAST. caveat: untested, but guaranteed to work. :)
>
> Really ;)
>
> Sorry, could not resist. ;)
i don't blame you, i would have responded also. makes me glad i added
the caveat though. :)
however, i don't think you can make it much faster. those functions
using calls to strtok() would have been sloooOOOooow.
Lauren
This archive was generated by hypermail 2b30 : 12/07/00 PST