Page 1 of 1

Question in Char Array

Posted: Wed Oct 09, 2013 8:49 am
by brian25
i'm using gsm lib and i want to separate the content of smsbuffer. ex Hello World then i will disregard the Hello and i will only get the World and store in Another byte/char array. tnx

Re: Question in Char Array

Posted: Wed Oct 09, 2013 8:57 am
by KeithB
look at strtok()

Re: Question in Char Array

Posted: Fri Oct 11, 2013 10:30 pm
by brian25
i used arduino lib

Regexp.h
Code: Select all
MatchState ms;
  char * str = smsbuffer;
  ms.Target (str);
  
  unsigned int index = 0;
  char buf [100];
  
  while (true)
  {
  char result = ms.Match ("(%a+)" "(%-?%d+)", index);
  
   if (result == REGEXP_MATCHED){
     for (int j = 0; j < ms.level; j++);
     gsm.WritePhoneNumber(result[j],(%-?%d+);
     index = ms.MatchStart + ms.MatchLength;
   }
   else 
     break;
  }
}

can you help how to correct this one.. tnx

Re: Question in Char Array

Posted: Tue Oct 15, 2013 10:40 am
by mlu
There is a semicolon to much in the for statement:
Code: Select all
     for (int j = 0; j < ms.level; j++);
should be
Code: Select all
     for (int j = 0; j < ms.level; j++)
I think the compiler is complaining about this because with the extra semi colon, j
will not be defined on the next line.
Also the gsm.WritePhoneNumber looks wrong, what is the second argument ?