LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

opening / writing to a text file

Hi
I wanted to be propmpted to open a text file initially, then write to the file uninterupted and without a prompt with a sequnce structure.
The problem is I can either always be prompted each time I write to the file or I have to pre-create the file before starting the program and have a constant in the file path. How can I get the program to prompt be only at the start of the program to create the file then write to it uninterupted within the sequnce?
thanks
See attached
0 Kudos
Message 1 of 4
(2,786 Views)
I think this is what you want to do. I added a case for the first loop, and one for all others. A shift register passes the file info to the other loops.
0 Kudos
Message 2 of 4
(2,786 Views)
Hi,
you must do the following things:
1. Create some path indicator
2. at the beginning of your vi wire the "Empty array constant" to it.
3. then create its local variables
4. in every file write/read operation wire the path local variable to the input of VI, and also wire "new file path" output from vi to anther local variable of your path indicator.

In this manner at the first step VI will create the prompt window, where you will specify the path. But then this value of new path will be passed to local variable and at the next time this path (not empty) will be passed to VI.

In any case it's easier to look on example.
The file is attached.

Good luck.

Oleg Chutko.
0 Kudos
Message 3 of 4
(2,786 Views)
Like Brian said, you can accomplish this with just the use of a shift register. A local variable will work but it's not the most elegant and you're already using more than you need. I also noticed that you're not using any error checking. If you wired up the error in/out connections, you'd have a more robust application and you could also eliminate the sequence structure which doesn't do much except make your program harder to read.
0 Kudos
Message 4 of 4
(2,786 Views)