LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

executable will not write data to file

I created a Main VI that calls a series of SubVIs, one of which reads a GPIB device and writes the data into a file in my root directory (c:\). The application works perfectly
as the main VI calls subsequent VIs and each close upon completion of it's task. There are probably 8 Sub VI routines that run, But only one that writes my data file.
Running this from the Labview 8 development system where the routines were created has been no problem and the data file ( which gets named automatically by the SubVI), contains date/time stamp, users initials, test specific parameters, and the GPIB read data. All as it should be.
 
Now! I created an executable of this application and it too works perfectly with the exception of the data file. My application executable runs to completion as I would expect, but once the exe completes, My file is not in the root directory where my SubVI creates it and wirtes to it. As I said, this is only a problem in the executable version of my application.
 
Does anyone have any ideas why the file isn't getting created?
 
BTW: I am getting no errors at runtime of my exe.. Also I have searched the entire HD and the data text file simply is not there.
 
HELP!!!!!!!!!!!
0 Kudos
Message 1 of 6
(3,782 Views)

The most likely reason is that you're building the path to the file using the path of the VI. When building a VI into an EXE, the EXE is treated as a directory, so the VI path is c:\....exe\VINAME.vi.

You can get around this by using a while loop to strip the path until you get a directory (using the File\Folder Info VI) or you can use the property Application.Kind to know whether you're running in LV or the exe and perform an extra strip. Placing a path indicator to see the actual path of the file should help you with this.

If this didn't help you, I suggest you post your code.


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(3,770 Views)

Thank you for responding so quickly!

I left out a couple of pieces of info that you may find important. I moved the exe file to a laptop for runtime operation. I thought that maybe this had something to do with it.

I also have built a second utility that also creates a file and dumps data into it. This app works ok as built. if you have any other suggestions, please post them.

I will try your suggestions as I need to rebuild. But the code is rather large to  make too many alterations this late in my game.

Thanks again for your help! It's greatly appreciated! 

0 Kudos
Message 3 of 6
(3,763 Views)

I am still unable to resolve this issue. Please help!

As suggested, I have added an indicator to display the filename and path to see if it is being created where I want it.

The path is correct but my filenaming convention is not working as it did before build.

Example: My SubVI takes field input to build the filename. i.e. a-1234 and concatenates with root directory (c:\) and .txt.

Although the indicator displays only part of the filename unconcatenated. i.e. C:\a-123 and no extension, the partial filename and data never make it to

the root directory.

Any help is greatly appreciated!

 

0 Kudos
Message 4 of 6
(3,743 Views)

First, make the indicator big enough to display the entire path. I suspect that this may help you see the problem.

Second, I suggest you use the Build Path VI instead of string concatenation.

Third, if you're still having problems, add more debugging indicators. Build in the ability to single step through the code to be able to see where the problem occurs.

If all this still doesn't help, at least upload an image of the code and what the FP with the debugging information looks like.


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(3,737 Views)

This issue has been resolved! Thank you for all your help! Through your suggestions I have identified my problem.

It turned out that some idiot locked up some paths on the laptop for security reasons making the root directory inaccessible.

I have removed all file write restrictions and I am all set.

Thanks Again very much! 

0 Kudos
Message 6 of 6
(3,713 Views)