News:

  • October 13, 2025, 03:45:35 PM

Login with username, password and session length

Author Topic: Help with HEX  (Read 1734 times)

willpoll

  • Sr. Member
  • ****
  • Posts: 54
Help with HEX
« 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!!

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: Help with HEX
« Reply #1 on: November 22, 2019, 04:53:37 PM »
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.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

willpoll

  • Sr. Member
  • ****
  • Posts: 54
Re: Help with HEX
« Reply #2 on: November 22, 2019, 05:29:25 PM »
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!!