Question
search a char array within an other char array
hi everyone
I'm trying to search for a certain char array(say char Temp[]) within a lager array in this case, char Rcv[500]. here is my code
int scanRcv(char *Temp){
int ii=0;
for(int i=0;i<RcvLength;i++){
while(Rcv[i]==Temp[ii]){
ii++;
if(ii==strlen(Temp))
{
return 1;}
else
{return 0;}
ii=0;
}
}but I don't know why it doesn't work and does not return 1, though I think the code works....
I also tried this code too but it didn't work either
int scanRcv(char *Temp){
if(strstr(Rcv,Temp)!=0)
{
return 1;
}
else
{
return 0;
}
}please help
