I got a probably small problem using memcmp. I have two arrays (length = 3 byte) with exactly the same data.
If I try to compare them with memcmp, it fails?!
if (memcmp(ucbuffer, ucnewbuffer, buffer.sDeviceData.sLenght)) {
cout << "val written, val ok!\n";
};
ucbuffer, ucnewbuffer are both unsigned char * and were allocated using
calloc(buffer.sDeviceData.sLenght, sizeof(unsigned char);
If i compare both arrays by hand, both it will result in being exactly the same.
Do you have any Idea?
Have a nice evening.
当缓冲区比较相等时,该函数返回零 (即不为true)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.