LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Path to refnum

How can I convert path to refnum? Currently I am doing it with Get File Size. But it seems an overkill. Any other simpler way?

Have a very nice day!
0 Kudos
Message 1 of 5
(10,055 Views)
Hi rashid196...,
for what do you need it? If you want a refnum out of a path you have to open the file. The "Get File Size" function is something like polymorphic and can both inputs (path and Refnum), so internal the "Get File Size" function also open your file.
 
Mike
0 Kudos
Message 2 of 5
(10,053 Views)
I want to write some text to a file using write to text file. But I want to write text at its end (i.e., append at the end of the existing file). For that purpose I have used Set File Position which requires a refnum. To convert path to refnum I use Get File Size (about which I am not happy since I do not require file size). So I was wondering if an elegant solution existed.
0 Kudos
Message 3 of 5
(10,039 Views)
You have to use Open File. The Write to Text File function will accept a path or a refnum. For a refnum it assumes the file has already been opened. If you wire a path then you can't use the Set File Position. That's how File I/O functions work.
0 Kudos
Message 4 of 5
(10,036 Views)

Hi rashid,

see the attached example.

Mike

Message 5 of 5
(10,028 Views)