ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

opening file

Solved!
Go to solution

I'm trying to open a file and view the hex.

 

When I open the file some of the hex values are replaced with 'FF' (I viewed the file using a hex viewer so I know what values should be).

 

I've tried opening the file as binary or string, the same thing happens.

 

I also tried changing the file type to a raw, bin and txt , none of which worked.

 

Any ideas what I am doing wrong ?

 

Thanks.

Download All
0 Kudos
Message 1 of 11
(5,618 Views)

Hi Eddie,

 

two comments:

1: Can you attach your binary file (or a part of it) as ZIP file for us to check the data?

2: Have you checked the right-click options of the ReadTextFile function? By default it will convert EOL chars…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(5,608 Views)

Hi, 

 

Thanks for the reply, I've attached the Image file in the post.

 

I tried changing the right click options of the ReadTextFile function still no luck.

 

 

0 Kudos
Message 3 of 11
(5,586 Views)

Hi Eddie,

 

I saw the picture before.

Can you attach the REAL data file (or a part of it) as ZIP?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 11
(5,583 Views)

Hi,

 

Yeah I edited the post so there should be a zip callled 'image.zip'.

 

I'll attach It here as well.

0 Kudos
Message 5 of 11
(5,577 Views)

Hi Eddie,

 

didn't notice your edit (and using the term "image" is quite ambiguous when you attached only images/pictures before).

 

Anyway, both file read functions give the same output from your file (tested with LV2011):

check.png

Note: I deselected "Convert EOL" in the ReadText function!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 11
(5,573 Views)

Hi, 

 

I agree, sorry about that. 

 

I've copied your example and It works, until I split the data using the 'search/split string' function, after which the 'FF' appear's again.

 

any idea why?

 

I've attached a print screen below' spiltString'.

 

Thanks again for the help.

 

 

0 Kudos
Message 7 of 11
(5,548 Views)

Hi Eddie,

 

even after splitting the string it keeps the same content as you can easily check:

check.png

And yes, there are a lot of "255d"/"FFx"/"377o" values in your file…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 11
(5,527 Views)

Hi,

 

The value 'FF' only appears when opening in labview. When I open the same file in a hexidecimal converter (I'm using notepad++) it shows them as other values. 

 

I think this could be because labview may not convert using the extended ASCII table. Therefore whenver a value is over 127 in the ASCII table it becomes a 'FF' which is not the value.

Kind regards,
Eddie.

 

attached is a sample of the Hex in a Hex viewer.

0 Kudos
Message 9 of 11
(5,493 Views)

Hi Eddie,

 

I never had any problems using LabVIEW file read functions. And I never had any problems with conversion from U8 array to string regarding magically changing data.

Infact I trust LabVIEW more than that HexEditor plugin of Notepad++!

 

When LabVIEW shows those $FF in your data then there are $FF in the data…

 

As a cross check you can verify LabVIEW by using this website: http://www.onlinehexeditor.com ! (Guess what: it shows the very same $FF as LabVIEW does…)

 

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(5,481 Views)