From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

EOF use on Read Lines From File VI

Hello,

Thanks for the time to ask this question.  I am a novice user of LabVIEW, so I may not be able to grasp a lot of terminology, but I can understand the basics.

I am using LabVIEW 7.1 and I am trying to read values from a file with a Read Lines from File VI.  This is happening inside of a while loop, each loop causing a new line to be read.  My goal is for the loop to terminate once the end of the file is reached.  I have tried to do this by wiring the EOF option on the Read Lines from File VI to the conditional terminal of the while loop (needs a true to end the loop).  My hopes is that this EOF option would give a true when the end of the file is reached.  I haven't been successful with this.

I have tried another option to end the loop when the end of the file is reached, but it is very complicated and difficult.  I wanted to ask if there is an easy way to do this.

ATTACHED: The LabVIEW file I've been working with, along with the file I've been reading from.  (not my difficult way of doing it)

Thanks for your help!

tvp9933
0 Kudos
Message 1 of 4
(6,349 Views)
Hi,
 The EOF flag is only valid when you are not reading the whole file at once. I've modified your vi to show how this is done. Good luck!
Simon
0 Kudos
Message 2 of 4
(6,330 Views)
Here is a wish to NI if anyone is "listening".  It seems like EOF is not set True until an attempt to read past the last line or byte is made.  EOF should be set to True as soon as the last line or byte is read.  Then there would be no need for the case structure in the vi posted by Nomis.  This is how the EOF flag in VB works.  When I started using Labview, it took me some time to get used to this implementation of EOF.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 4
(6,318 Views)

Hi Folks

      The EOF flag seems to work fine if reading line by line.  Just don't put a line-feed at the end of the last line of data, else LabVIEW has to read one more line (empty of values) before it detects EOF.

There's a lot more potential to simplify TVPs code (it's begging for a spreadsheet-string-to-array function) but one thing at a time!

Cheers

 

 

Message Edited by Dynamik on 05-05-2006 01:45 AM

When they give imbeciles handicap-parking, I won't have so far to walk!
Download All
0 Kudos
Message 4 of 4
(6,306 Views)