joydeepsarkar87
Member level 2
I am using GSM modem to send the text msg to the number who has sent the previous msg to the GSM modem (i.e, REPLY to sms) I am able to retrieve the phone no. and have stored the phone no. is a array. I have also created another array for storing the msg. However wen i read the phone no. array which i have set the limit to size 12 only also includes part of the elements of msg array also.... Later on i found out dat since both the arrays have taken sequential memory locations (i.e, phone array ends at memory location 05B and msg array starts from memory location 05C.
Hence to retify this prob I created a function as below...
lcd_putnstr(13,phone_num_buf); // to check the no. where the msg is being sent.
void lcd_putnstr(unsigned char len, char *str)
{
unsigned char i = 0;
while(*str != '\0' && i < len)
{
lcd_write(*str);
str++;
i++;
}
}
void putnstr(unsigned char len, char *str)
{
unsigned char i = 0;
while(*str != NULL && i < len)
{
putch(*str);
str++;
i++;
}
}
putnstr(SIZE_OF_PH_NUM, (char* )phone_num);
#define SIZE_OF_PH_NUM 13
have declared the function where ever required but wen i compile it throws an error as...
Error [1098] conflicting declarations for variable and it points to putnstr function..
how this bug can be resolved???
[/b]
Hence to retify this prob I created a function as below...
lcd_putnstr(13,phone_num_buf); // to check the no. where the msg is being sent.
void lcd_putnstr(unsigned char len, char *str)
{
unsigned char i = 0;
while(*str != '\0' && i < len)
{
lcd_write(*str);
str++;
i++;
}
}
void putnstr(unsigned char len, char *str)
{
unsigned char i = 0;
while(*str != NULL && i < len)
{
putch(*str);
str++;
i++;
}
}
putnstr(SIZE_OF_PH_NUM, (char* )phone_num);
#define SIZE_OF_PH_NUM 13
have declared the function where ever required but wen i compile it throws an error as...
Error [1098] conflicting declarations for variable and it points to putnstr function..
how this bug can be resolved???
[/b]