LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't access .txt file in 2011 executable

Solved!
Go to solution

In LabVIEW 2010 or 2011 I open a .txt file in a read file program that is one level below the main routine.

 

When I make an executable of the main routine it can't find the .txt file even when I put in the executable folder and at a directory level above.

 

Used to work in LabVIEW 8.0.

 

Thanks,

Mark

0 Kudos
Message 1 of 22
(3,980 Views)

Can you post some code so we can look at it?

 

Are you accessing the .txt file with a relative path? When built into an executable, there is one extra layer added to the path that must be stripped.

 

example in development environment:

vi path = c:\<vi location>\vi_name.vi

in executable:

vi path = c:\<executable location>\executable.exe\vi_name.vi

 

     Rob

Message 2 of 22
(3,979 Views)

Are your OSs the same?  Windows 7 has placed more stringent restrictions on file access.

0 Kudos
Message 3 of 22
(3,970 Views)

I have Windows 7.  What's the fix?

 

When I make an executable of the READ subroutine by itself it works fine (like it always did in Windows XP LabVIEW 8.0).

 

Making an executable of the MAIN program for which the READ is a subVI one layer beneath MAIN it can't find the text file.

 

Thanks,

Mark

0 Kudos
Message 4 of 22
(3,962 Views)

How can I post the code?

 

When I copy the block diagram I get a message saying I've exceeded 10,000 words.

 

I can send a zip file of the whole thing if you tell me how to attach it.

 

Thanks,

Mark

0 Kudos
Message 5 of 22
(3,959 Views)

You can send in a ZIP file by pointing to it with the Attachments box right below where you enter your message on the board.

 

Here:Add Attachment.png

Have a good day.

 

     Rob

Message 6 of 22
(3,955 Views)

Here is the zip file with all the code.  MAIN VIDAQ is the top level.

Read VIDAQ Variables reads the .txt file.

 

Thanks,

Mark

0 Kudos
Message 7 of 22
(3,953 Views)

Your code is looking for the file to be in the same directory as the EXE.  If running as source, it is looking one directory above the code.

0 Kudos
Message 8 of 22
(3,944 Views)

That's true but it doesn't work.  Can't find the .txt file in the .exe folder even though I put it there.

 

That's the problem I'm experiencing.

 

I know what it should do but it's not doing it.

0 Kudos
Message 9 of 22
(3,939 Views)

When I use the full path name for the .txt file it works.  Of course now I have to know in which directory the executable will go before I make the build.

 

Another big dissappointment.

0 Kudos
Message 10 of 22
(3,936 Views)