memcmp和strcmp差别
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> #include <signal.h> #include <string.h> static char usbcmd[] = {0x11,0,13,0,15}; static char recevecmd[] = {0x11,0,13,14,15}; //memcmp int memcmp(const void *str1, const void *str2, size_t n) int main() { // char ret = memcmp(usbcmd,recevecmd,5); printf("ret memcmp is %d\n",ret); ret = strcmp(usbcmd,recevecmd); printf("ret strcmp is %d\n",ret); for(;;); return 0; }
一勤天下无难事。