AnsweredAssumed Answered

search for matching string on the other string

Question asked by mahmoud on Aug 31, 2015
Latest reply on Aug 31, 2015 by Clive One
hi every body
i have a problem with strstr function,
i receive characters from uart with interrupt & save them on the n length array(buffer array),
then in main loop i check buffer with strstr function from string.h for finding a special arrayof characters(for example" hello"),it works fine for the first time but some time it dosent work and without receiving that array of string it act like when find matching.

sample code :

interrupt handler ,when character received,it save that in the buffer:
void USART1_IRQHandler(void)
    /* RXNE handler */
main loop:
in some primary matching it works fine (when i type "hello",it return "1234") but after some tries it permanently return "1234" without matching
     string_pointer = strstr (Rx_Buffer, "hello");
     USART_SendData(USART1, '1');
             Rx_Buffer[loop_counter]=' ';
     USART_SendData(USART1, '2');
     USART_SendData(USART1, '3');
     USART_SendData(USART1, '4');
i used stm32 & keil
thanks for any help