LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble building a Hex number for use in a binary file search.

Hello all,

I'm trying to parse a binary file for a particular hex string.  When constructing the search string, I encountered a problem that I cant seem to get around.  My search works fine if I use a string constant set to display and enter FF00 00FF.  If I try to build the hex string using Number To Hexadecimal String, I get different results and don't know why.  Please see the attached vi.  I hope I was clear enough in my questioning.

Thanks in advance,
Mark
0 Kudos
Message 1 of 4
(2,595 Views)
Hi Mark,
if you use the "Number to hexadecimal String" function you get the hex value as a string, your other constant "0001" is as string this byte array [0, 1], so there are differences. What do you need?

Mike
0 Kudos
Message 2 of 4
(2,592 Views)
You need to understand the distinction between hex values and hex characters. The hex value of FF refers to the value of 255 decimal, while the hex characters "FF" refers to the character/letter "F", followed by the character/letter "F". Each character is an ASCII character, and the character/letter "F" has an ASCII value of decimal 70, which is a hex value of 40.
Message 3 of 4
(2,586 Views)
To get the output you want, you need to typecast a U16 number. (Your number constant is currently I32, so you would get 4 bytes out of it).
 
Of course if the number input is actually from a control, make the control the correct representation.
 
 


Message Edited by altenbach on 06-04-2008 10:36 AM
0 Kudos
Message 4 of 4
(2,580 Views)