LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from Text File - Help Bug?

Hi - I am currently working on LV8 and I think that there is some misunderstanding potential in the help file. To be more exact in the help to the "Read From Text File" VI.

The description for "count":
" ... If count is <0, the function reads the entire file. The default is –1, which indicates to read a single line if you placed a checkmark next to the Read Lines shortcut menu item and to read the entire file if you removed the checkmark next to the item. "

If count is lower than zero, the function reads the entire file. That sounds clear to me.
The default is -1, which indicates to read a single line if you placed a checkmark next to the "Read Lines" shortcut menu item. Now what? Does it read a single line or the whole file?
.. and to read the entire file if you removed the checkmark next to the item. I thought it reads the whole file if I use -1 ?

the VI itself behaves as I'd expect it to:
* If I place a checkmark next to Read Lines and put -1, I get an array containing the lines
* If I remove the checkmark, I get only a single string item.

Now where is the error? Is the VI not working properly or only the description a little bit ... strange ?

Message 1 of 6
(3,770 Views)
Sugar is something that gives coffee a bad taste when you forget to put some in it.
Chilly Charly    (aka CC)
Message 2 of 6
(3,749 Views)

?hein??

?what?

Both you guys lost me..

And I drink coffee without sugar (being sweet enough, already)  😉

Here is what I get from Context Help on the Read From Text File:

Read from Text File

Reads a specified number of characters or lines from a byte stream file. By default, this function reads all characters from the text file. Wire an integer value to count to specify how many individual characters you want to read starting with the first character. Right-click the function and place a checkmark next to the Read Lines option in the shortcut menu to read individual lines from the text file. When you select the Read Lines option in the shortcut menu, wire an integer value to the count input to specify how many individual lines you want to read from the file starting with the first line. Enter a value of -1 in count to read all characters and lines from the text file.

Humm.

New feature (again)..  If you select checkmark the Read Lines option, it will not send the text to a sting indicator, as shown in the attached image.  If selected, then it's expecting to write lines to an array of strings...  WHY???  I don't know..  I'll ask..

Strange...  LV8 is full of mysteries...  😉

RayR

Download All
0 Kudos
Message 3 of 6
(3,743 Views)

Actually,

If you do select "checkmark" Read Line and wire in a -1, then you have the string array as an indicator.  The result is that the indicator will contain all the lines (entire file) with each array elemnt as a line from the file.  Nice feature, actually.

Time for more coffee... 😉

no sugar, please!

0 Kudos
Message 4 of 6
(3,731 Views)
Seeing as I don't drink coffee, maybe I'll take a crack at this. Smiley Happy

JoeLabVIEW: Tom is referring to the help in the main LabVIEW Help file, not the context help.

Tom: You're right. The text in the help file is confusing, at best, given the way the function really works, which is even more confusing. I swear that every major version of LabVIEW the file I/O functions get fiddled with and they just get more and more confusing. What's so difficult about making simple file I/O functions, I ask?

Anyway, if the "count" input is not wired, the function behaves as described in the Help file. In other words, if "Read Lines" is not checked, it reads the entire file into a string output. If the "Read Lines" is checked, it reads only the first line into a string output.

Where it gets confusing is when you actually wire a constant to the function. If you wire a -1, it should behave identical to not wiring anything, if the default really is -1, as it says in the Help file. BUT.... that's not what happens, as you and JoeLabVIEW saw. If you wire a -1 and "Read Lines" is not checked, it reads the entire file into a string output. If you wire a -1 and "Read Lines" is checked, then it reads the whole file into a string array output. Go figure.

Now that's not really confusing, right? Yeah, right.
Message 5 of 6
(3,730 Views)

Yep..

Very confusing.
Plus I didn't have enough coffee, yet....  What's the count now? 8??  I'm ok for 2 more.

I agree...  Whatever happened to the KISS principle??  Maybe if they were allowed into the Music Hall of Fame?? 😉

Now that's confusing....

LOL!!!  😄 😄

0 Kudos
Message 6 of 6
(3,722 Views)