LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems creating new "file"

I am having problems with creating a new file/replacing an existing file. Here is a sample of the code I wrote that worked fine.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 1 of 9
(3,377 Views)
The problem is I don't want the operator to be prompted to select where to save the file (unless he is overwriting an existing file), so I modified the code to this second sample I'm attaching. But with this code, it doesn't even create the new file. Can anyone see what I'm missing here?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 2 of 9
(3,374 Views)
Hi spaceman spif,

The "default name" input of the Open/Create/Replace File VI is for file dialog usage only. In you case you should use a Build Path VI (found under file I/O function palette) to compose the filepath.

See attached file for example.

Hope this helps,
Dan
0 Kudos
Message 3 of 9
(3,366 Views)
It worked.

It seems a little goofy (and redundant) to me that wiring a path name to the path input doesn't work, but if you wire a path name to a "build path" tool THEN it will work. I'm trying to teach myself LabView and little things like that keep tripping me up!

Thanks for your help!
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 4 of 9
(3,363 Views)
Glad to help.

In the help it states "default name is the name you want to appear as the initial file or directory name in the dialog box. The default is an empty string." That input is not used for filename. For all the LabVIEW built-in file I/O VIs I've encountered, you should always wire the complete file path, including filename, to the FILE PATH input.
0 Kudos
Message 5 of 9
(3,358 Views)
I hope this isn't a silly question, but when I viewed the help for the "open/create/replace file" tool it said this for the file path:

"file path is the path name of the file. If file path is empty (default) or is (not a path), the VI displays a dialog box from which you can select a file. Error 43 occurs if you cancel the dialog box."

That is different from what your help says. The help I read for mine implies that the dialog box pops up only if you don't wire a path to it, leading me to think if you wire a path to the file name it will automatically use that file without bringing up a dialog box. It says nothing about the file path input being used only to specify the initial path for the dialog box - which is what your help says.

I'm using LabView 7.1, is there a difference in help dialogues between versions of LabView?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 6 of 9
(3,350 Views)
Whoops! Ignore my last post, I read your response too quickly! You were referring to "default name" not "file path" help.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 7 of 9
(3,350 Views)
Could you please post the example in version 7.0?
0 Kudos
Message 8 of 9
(3,164 Views)
Here you go...
0 Kudos
Message 9 of 9
(3,155 Views)