Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: willpoll on November 22, 2019, 04:37:14 PM
-
Hi,
I have a number between 0 and 1023 for example 198, represented as HEX 00C6, being captured via a streamin into two contiguous buffers RemBuff23 and RemBuff24.
I used strputb to place the two buffers into a single string (SS121), in my data view, SS121 appears as "00 C6", minus the quotes, but with a visible space in between. When I try to use str2int, it appears to only evaluate the "00" and not the "C6".
I tried to use strdelete to remove the space but it seems its not actually there.
How do I convert this into an integer?
Thanks!!
-
Put your string into a data view, and set the format to hexadecimal. It should give you something like 30 30 43 36 if it is what you think it is. That's working for me. My guess is that isn't what's there.
-
Thanks BobO.
I actually got it working by using a STRPRINT instead of STRPUTB. My data view showed hex 00 C6, but that's apparently not what was getting to the STR2INT.
I went with - STRPRINT, no space added, FmtInt(REMBuff23,hex) FmtInt(REMBuff24,hex) and my STR2INT started working.
So, STRPUTB to SS121, index 0, length 2, starting element RemBuff23 does not yield the same output string.
Thanks again!!