Associate II
April 4, 2023
Question
What is the correct way to assing value to array in SPC5 Studio
- April 4, 2023
- 4 replies
- 3109 views
Hi I've declare a 3 byte array uint8_t hex_str[3] and assign a value to convert Hex string to int using strtoul function the point is I set hex_str[2] = 0 but cannot.
Here Is my code capture I do breakpoint at line rowIdx = (uint16_t)strtoul(hex_str, NULL, 16);
but hex_str[2] is not 0 as I just assigned
hex_str[0] and hex_str[1] is correct assigned by input array uRxBuf [12] and uRxBuf[13]
That cause strtoul give out a wrong output
please help correct me what I did wrong
Edit 1:
I try change type of hex_str to uint8_t, int8_t, char, unsigned char it give the same output
