07-02-2009 01:35 PM
Dear all,
I use File Dialog to open a file and read the content of it. However, I want to show the name of the opened file and don't know how to do it.
Anybody has an idea to display the name of the opened file?
Thanks.
Solved! Go to Solution.
07-02-2009 01:40 PM
Hi powerplay,
the File Dialog has an "selected path" output. You can use the strip path function to get only the filename.
Mike
07-02-2009 01:46 PM
The express VI in the Advanced File I/O functions?
It has an output that is the selected file path. You can wire an indicator to that.
07-02-2009 01:51 PM
I think you use the pop-up from the 'read from file' primitive, to get the file name use the following code:
The Refnum to Path will read the data at the file reference and returns it actual path.
Ton
07-02-2009 02:21 PM
thanks for your prompt replies. I really appreciate that.
10-15-2020 01:51 PM - edited 10-15-2020 01:56 PM
Warning:
This technique {Refnum to Path} does not appear to work with configuration (.ini) files having Sections and Keys.
10-15-2020 10:14 PM
No. It won't. Because the refnum the Config functions use is not a file refnum, but a refnum for a queue.
The queue is a single element queue and the cluster that defines the queue has the file refnum as an element within it, along with the config data and a boolean flag.
You can open up the Config File subVI's to see how they handle the file reference. It basically wraps the information up in a single cluster and guards against simultaneous access using a a single element queue size.
But I don't know of a reason to ever use the technique in this thread. If you ever generate a file reference, then you had to open a file with a known file path. Just carry along that file path/name to where you need it rather than trying to back out the file name from the reference wire.
10-16-2020 09:11 AM
@johnwhitcraft wrote:
Warning:
This technique {Refnum to Path} does not appear to work with configuration (.ini) files having Sections and Keys.
There's a separate function for that in the "Configuration File VIs" palette: "Not A Config Data Refnum.vi"