Jump to content

What is wrong with this tiny code?


Recommended Posts

Hi,

I am trying to detect the Header Start Byte in a string of data sent though TCP/IP by myself. The string of data is built by concatenate the string converted from array of byte data. When I receive it, I just do in the reverse order. And the match pattern function doesn't work. But if I convert the string to array of byte, I can search it. I post this becaue I want to understand what I did wrong.

Thank you,

Thang Nguyen

I have my code here:

TestScanString.vi

post-7703-127238746736_thumb.jpg

Link to comment

Hi,

I am trying to detect the Header Start Byte in a string of data sent though TCP/IP by myself. The string of data is built by concatenate the string converted from array of byte data. When I receive it, I just do in the reverse order. And the match pattern function doesn't work. But if I convert the string to array of byte, I can search it. I post this becaue I want to understand what I did wrong.

Thank you,

Thang Nguyen

I have my code here:

Hex 24 = $ which is special character for the match pattern. Check the help on Match pattern and look at "special characters"

Ben

Link to comment

Hex 24 = $ which is special character for the match pattern. Check the help on Match pattern and look at "special characters"

Ben

I used a Format Into String to escape the special character and it works correctly (you need to escape the escape character in the format string in order to get the escape character into the Match Pattern, hence the two "\"s).  The "offset past match" will be one more than the "index of element" from your Search 1D Array.    

post-7534-12725457511_thumb.png

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.