LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

a problem with File I/O functions

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 18
(3,257 Views)

Hi,

 

What is the error you are getting from the error out terminal?

 

FLash

National Instruments
Applications Engineer
0 Kudos
Message 2 of 18
(3,223 Views)

Post your code.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 18
(3,203 Views)

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. 

Message 4 of 18
(3,190 Views)

Thanks for reply.This is the error message:

 

2.JPG

0 Kudos
Message 5 of 18
(3,162 Views)

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:

c1.JPG

 

the c2.JPG sub VI is:

 

c3.JPG

 

0 Kudos
Message 6 of 18
(3,148 Views)

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

Regards,
Srikrishna


0 Kudos
Message 7 of 18
(3,145 Views)

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

0 Kudos
Message 8 of 18
(3,145 Views)

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. 

0 Kudos
Message 9 of 18
(3,123 Views)

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:

 

Message Edited by smercurio_fc on 06-04-2010 09:34 AM
Download All
0 Kudos
Message 10 of 18
(3,095 Views)