Question
The best way to compare two buffers
Posted on March 30, 2013 at 10:49
Hello, I�m begineer in programming in C and microcontrollers, so I�m sorry for stupid question. I receive commands via USART. What is the best way to compare RxBuffer with command saved in memory? Now I use comparing single bytes (1.byte with 1.byte, 2.byte with 2.byte,...), but this isn�t good solution(big code,...). Thanks for answers.
uint8_t RxBuffer[100]; // for example RxBuffer[0]=82, RxBuffer[1]=83, // RxBuffer[2]=84, RxBuffer[3]=10 ...RST\n uint8_t IDNcommand[] = ''IDN\n''; uint8_t RSTcommand[] = ''RST\n''; . . . // how to smartly compare these buffers? // problem: they have different size #parser #parsing