LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

inaccurate text results when writing to text file

Can someone run my attached sample and see if you get the same result as me?  The VI simply flattens a control cluster and writes it to a text file then reads it back.

Here's the behavior I can't explain:  Enter a number in the first control between 0 and 3327, press the "write" button.  Now press the "read" button and the result in the corresponding control of the "read back" cluster should match that value.

Now do the same with any entry between 3328 and 3583 and the result does not match.  The range of numbers that doesn't work is hex  D00 to DFF. It doesn't seem to work with 3-digit hex values beginning with "D".  If you look at the text string that is returned, the "D" is changed to "A".

Any ideas what is going on?

thanks,

Dave

0 Kudos
Message 1 of 6
(2,813 Views)

You definitely should not use text file I/O with binary data. Use the binary file I/O function instead! 🙂

However, things should work fine in this case if you right-click on the file functions and uncheck "convert EOL". Try it.

Message 2 of 6
(2,809 Views)
Wow that was fast!  I refreshed the page to see if my post was alright and there was your response.

And your advice worked, of course. 

What is the danger of using text instead of binary?
0 Kudos
Message 3 of 6
(2,804 Views)
Hi Timber,

it's already in Altenbachs reply: in text file vi's there is a 'Convert EOL' option.
This option converts any 0x0D/0x0A characters like in your case...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(2,797 Views)
I think I get the point: A string can be interpreted a number of ways that are platform dependent, but binary is binary.

Thanks for the help.
0 Kudos
Message 5 of 6
(2,781 Views)
Until you start to worry about big-endian and little-endian... Smiley Very Happy
0 Kudos
Message 6 of 6
(2,773 Views)