[NTLUG:Discuss] OT C question

Fred James fredjame at fredjame.cnc.net
Sat Feb 18 20:29:30 CST 2006


All
Thanks to your help I was able to replace

        for ( i = 0; i < Max; i++ ) {
                if ( s[i] == S[Sptr] ) {
                        if ( i == Limit ) {
                                S[Sptr] = s[0];
                        }
                        else {
                                S[Sptr] = s[i+1];
                        }
                        i = Max;
                }
        }

with

        S[Sptr] = *((strchr(s,S[Sptr]))+1);

... where s and S are each a char *, and Sptr is an int.

Thank you
Regards
Fred James





More information about the Discuss mailing list