06-02-2010 04:45 PM
Hi guys,
I am having this problem:
I am using File I/O functions im my LabVIEW code to store my data in a text file. First I use "Open/Creat/Replace File.vi" function to open my text file. Then using "Write File" function I write the data in the file and finally I close the text file using "Close File" function.
The problem is that when my LabVIEW program is running I can not open this text file. My program is not using the txt file during running, so practically I should be able to open my txt file when it's free (I mean closed). I've got no idea why I can't open my txt file.
Any help would be really appreciated.
Thanks
Solved! Go to Solution.
06-03-2010 02:00 PM
Hi,
What is the error you are getting from the error out terminal?
FLash
06-03-2010 03:07 PM
06-03-2010 04:52 PM
2107911 wrote:Hi guys,
I am having this problem:
I am using File I/O functions im my LabVIEW code to store my data in a text file. First I use "Open/Creat/Replace File.vi" function to open my text file. Then using "Write File" function I write the data in the file and finally I close the text file using "Close File" function.
The problem is that when my LabVIEW program is running I can not open this text file.
What program are you trying to use to open the text file while the LabVIEW program is running? Some applications require exclusive access to the file. For example, if you're trying to open the file using Excel you will get a notification that the file is locked for editing and it will ask you if you want to open it read-only.
06-03-2010 10:13 PM
Thanks for reply.This is the error message:
06-03-2010 10:38 PM
tbob wrote:Post your code.
My program is a data acquisition code which uses a DAQ card to read the voltage of a laser detector.
In this part it saves the acquired data into a text file:
the sub VI is:
06-03-2010 10:45 PM
06-03-2010 10:46 PM
smercurio_fc wrote:
2107911 wrote:Hi guys,
I am having this problem:
I am using File I/O functions im my LabVIEW code to store my data in a text file. First I use "Open/Creat/Replace File.vi" function to open my text file. Then using "Write File" function I write the data in the file and finally I close the text file using "Close File" function.
The problem is that when my LabVIEW program is running I can not open this text file.
What program are you trying to use to open the text file while the LabVIEW program is running? Some applications require exclusive access to the file. For example, if you're trying to open the file using Excel you will get a notification that the file is locked for editing and it will ask you if you want to open it read-only.
Wow! It worked.
I was using "WordPad" to open the file. I tried "Notpad" and it worked. So it seems that you are right.
Thank you guys for your time specially smercurio_fc
06-04-2010 12:20 AM
srikrishnaNF wrote:Hi 2107911,
Did you get the solution for your problem?I want to ask you whether your are getting this error while your program for saving the data is running or it is there for any labview program that is running?
Thanks and regards,
srikrishnaNF
Hi,
Thanks to Smercurio_fc, I found the solution. I have this problem when I use WordPad or Word to open the file. Smercurio_fc is right, it seems that these applications require exclusive access to the file.
Honestly, it makes no sense. Even while my program is running it's not using the data file. So other programs should have exclusive access to the file.
Anyway, I did what you asked. I closed my program and tried to open the data file while another labview program was running, no error message appeared.
06-04-2010 09:34 AM - edited 06-04-2010 09:34 AM
Mojtaba Rezaei wrote:Hi,
Thanks to Smercurio_fc, I found the solution. I have this problem when I use WordPad or Word to open the file. Smercurio_fc is right, it seems that these applications require exclusive access to the file.
Honestly, it makes no sense. Even while my program is running it's not using the data file. So other programs should have exclusive access to the file.
It makes perfect sense. The issue isn't whether the LabVIEW program is "using" the file - it's whether the file is open. See the following scenarios:
Scenario 1:
Scenario 2: