LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to check for EOF before calling a

I would like to use the read file vi to get a line of data from a file but I need to check for the EOF (end of file) condition first, otherwise it generates an error if it has reached the end of file. The "read lines from file" VI has an EOF? output but the "read file" VI does not. There must be a way to check the EOF condition but I cant find it. Please help.
0 Kudos
Message 1 of 3
(3,031 Views)
Try EOF.vi under File I/O>Advanced File Functions in functions palette. (Row 1, Column 4 on my 6.02 palette)
Message 2 of 3
(3,031 Views)
Spaz made a good suggestion, but let me expand. The error you get tells you that you've reached (or exceeded) the EOF. If you simply check for that error code (4) you can handle the case gracefully. Many times, I'll just set up to read a file line by line (or chunck by chunck) until I get that error. My buddy Mike Porter always likes to teach folks that errors are your friends.

If you have some clear specifications for your whole application, consider hiring an Alliance Member (like us). You will end up with a most professional example of LabVIEW code to learn from and tweak as you like.

Alliance Members are here to help. We do this stuff every day.


Daniel L. Press
PrimeTest Corp.
www.primetest.com
0 Kudos
Message 3 of 3
(3,031 Views)