From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Error 7 when opening file running LabVIEW 2010 executable

Solved!
Go to solution

I am using Open/Create/Replace File in LabVIEW 2010 to open a text file.  This works fine until I compile the code.  I then get Error 7. I have tried paths that look like the following but none work.

 

c:\<directory name>\file.txt

c:\<application name.exe>\file.txt

c:\<application.exe>\<directory name>\file.txt

 

Thanks

 

0 Kudos
Message 1 of 4
(2,949 Views)

Why do you have a text file that is stored in a subdirectory called read.exe?

 

Do you actually have an executable called Read.exe?

0 Kudos
Message 2 of 4
(2,946 Views)

I thought when VIs were compiled the paths were changed to preserve the hierarchy to reflect how they are saved.  My intent is to show the file as being in a subdirectory in the folder the .exe is in.

0 Kudos
Message 3 of 4
(2,943 Views)
Solution
Accepted by topic author utah4665

You have to get the path to the folder of the .exe.  Then strip off the .vi name and the .exe name.  Then Build onto the path from there to get to your .txt file.  The way you have it, you are treating the .exe as a folder rather than a file.  The text file is not part of the .exe, so you can't create a path that includes the .exe name.

 

Why Does My Executable Not Work When Using the Current VI's Path Constant?

Message 4 of 4
(2,938 Views)