LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read TXT File - EOL encountered

Solved!
Go to solution

Hi,

I have some parallels loop feed with a queue. I have a button to start reading a txt file and send it to some display.

The problem is that after some time I get the error:

"LabVIEW: (Hex 0x4) End of file encountered.
=========================
Invalid argument or arguments to function call."

 

I use the queue status to stop this loop. Any ideas on how to solve this issue?
Thank you

 

PMSilva_0-1583225552627.png

 

0 Kudos
Message 1 of 5
(2,733 Views)

Hi PM,

 


@PMSilva wrote:

The problem is that after some time I get the error:

"LabVIEW: (Hex 0x4) End of file encountered.

I use the queue status to stop this loop. Any ideas on how to solve this issue?


Why is it a problem to get the error message "EOF encountered" when you are trying to read past the end of the file?

How is this related to the queue status?

What exactly is "the issue"?

Best regards,
GerdW


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

I have the main program that is reading some data from CAN.
I have a parallel loop that I can enable to store the data in a txt file.
However, I want to add a feature to use the same program to replay the data logged into the txt file. So i need to figure out to have no error when I get the EOL. Can I search if I am at the EOL and point again to the start of the txt file and make like a loop. The question is... When I close or stop the application, do I need to perform the Close file?

0 Kudos
Message 3 of 5
(2,698 Views)
Solution
Accepted by topic author PMSilva

Hi PM,

 


@PMSilva wrote:

So i need to figure out to have no error when I get the EOL. Can I search if I am at the EOL and point again to the start of the txt file and make like a loop.


You don't need to "figure out to have no error" - you need to "figure out how to handle that error"!

 

Suggestion:

IF error THEN SetFilePos(Start)

Looks rather simple: check for EOL error and set fileposition back to start…

 


@PMSilva wrote:

The question is... When I close or stop the application, do I need to perform the Close file?


How is this related to your EOF problem?

You should close all references (including file references) before stopping your executable…

Best regards,
GerdW


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

Indeed...
I remove the Close Reference outside the loop that reads each line, and the program when i get the EOL starts reading again the file. With this i can handle it... and make some other changes.

Thank you for the help.

0 Kudos
Message 5 of 5
(2,611 Views)