Re: I think I'm gonna cry. (or newby problems with simple string function)
- From: "tedu" <tu@xxxxxxxxxxxxx>
- Date: 29 Sep 2005 16:29:22 -0700
tedu wrote:
> robbie.carlton@xxxxxxxxx wrote:
> > int i = 0;
> > int len = strlen(str);
> > char ch;
> > int start = 0;
> > int mode = 0;
> > int t = 0;
> > for (i = 0; i < len; i++) {
> > ch = str[i];
> > if (mode == 0) {
> > if(!isspace(ch)) {
> > mode = 1;
> > start = 0;
> > }
> > } else {
> > if(istax(ch)) {
> > ret[t] = extract(str + start, (i + 1) - start);
> > t++;
> > } else if(isspace(ch)) {
> > mode = 0;
> > ret[t] = extract(str + start, (i + 1) - start);
> > t++;
> > }
> > }
> > }
>
> you aren't reassigning start nor using t in a meaningful way.
er, sorry, t is ok. i still think you want to be doing something more
with start.
.
- References:
- Prev by Date: Re: Detecting Reads of Global Uninitialized Variables
- Next by Date: Re: how to convert an unsigned char to byte
- Previous by thread: Re: I think I'm gonna cry. (or newby problems with simple string function)
- Next by thread: Re: I think I'm gonna cry. (or newby problems with simple string function)
- Index(es):