Re: ^Ms, easier solution correction!

From: Patrick Stecker (pstecker@huey.csun.edu)
Date: 11/27/95


>void remove_CRs(char *string)
>{
>    register char *ptr;
>
>    ptr = string;
>    do {
>        if (*string != '\r') 
>            *ptr++ = *string;
>        ++string;
>    } while(*string);
>}

        Just add a little '*ptr = '\0';' after the while loop.  Currently
the string will be the same length it originally was.  When you take out the
\r's, it will have a new length, but the NULL doesn't move from where it was
before.  (dunno if thats clear.. hmm).  Now let this damn thread die, who
would've thought so many people would get so upset over a silly little \r
problem.

>this
 i
s a 
tes
t
>
>this is a testes
t
               ^- thats where the new NULL character should be.

>So unless I did something wrong, this thing needs to go back to the 
>drawing board. So much for the "guarantee"... I WANT MY MONEY BACK! What? 

        Money back?  Look at the sign... *points to a sign saying, "All
programs are used at your own risk.".

>Oh, nevermind. I forgot it was free. You don't happen to work for 
>Macro$oft do you? (No, I'm sorry. I'm just a little resentful cause you 
>put down my nice little program like it was a piece of garbage! :(

        Lets say for a minute here, that it *IS* garbage (not saying it is,
or isn't, just hypothetically speaking).  You are aware that bums and
homeless people eat out of garbage cans everyday.  So look on the bright
side.  You've made some homeless people very happy! :D

Patrick
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
|                                                                      |
| Thought of the week:                                                 |
|   Don't you think they should repair the London Bridge?              |
|   It keeps falling down!                                             |
|                                                                      |
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#



This archive was generated by hypermail 2b30 : 12/07/00 PST