cancel
Showing results for 
Search instead for 
Did you mean: 

<string.h> functions stop working

Ala
Senior

had anyone have the experience of <string.h> functions stop working and prevent the whole programm to proceed?

3 REPLIES 3
KnarfB
Principal III

No. Would be helpful if you provide more details...

Ala
Senior

thanks KnarfB

here is the example:

below you can see two functions, they both are same, but call() works and sms() doesn't:

void call(void){
 
ret=strstr(Rcv,"CALL");	//cheking "Call" phrase in Rcv array
if (ret) 
{
Rcv[(int)(ret-&Rcv[0])]='X';	//check mark to avoid looping
			  
 for(int n=0;n<13;n++)         //check which user to call
{
Call_Num[n]=Rcv[(int)(ret-&Rcv[0])+5+n];
}
for(int j=0;j<MaxUsers;j++)   //check which user is selected to be called
 {
if(strcmp(Call_Num,USERS_Num[j])==0)   //check which user is selected to be called
{     
//do stuff	
	}
  }
}
}
void sms(void){
ret=strstr(Rcv,"SMS");	//cheking "SMS" phrase in Rcv array
if (ret) 
{
Rcv[(int)(ret-&Rcv[0])]='X';	//check mark to avoid looping
for(int n=0;n<13;n++)         //check which user to send sms
{
SMS_Num[n]=Rcv[(int)(ret-&Rcv[0])+4+n];
}
for(int j=0;j<MaxUsers;j++)   //check which user is selected to send an SMS
{   
if(strcmp(SMS_Num,USERS_Num[j])==0)   //check which user is selected to send an SMS
{	     
//do stuff	
					}
			  }
}
}

in debugger mode I check and I see that USERS_Num[0] is just equal with Call_Num and SMS_Num. line 13th of sms() doesn't recognize this. also sometimes call() doesn't work eighter!

why is that?

TDK
Guru

I think you need to better define the problem you're having. "Doesn't work" is ambiguous. Nobody else knows what your program is trying to do except you, we can only assume. The bug is probably not in the <string.h> file.

If you feel a post has answered your question, please click "Accept as Solution".