Selecting a File Programmatically for Reading and Writing
Complete the following steps to select a file programmatically for reading and writing.
Select the Open/Create/Replace File VI on the Functions»File I/O palette and place it on the block diagram. Alternatively, you can select the New File or Open File function on the Functions»File I/O»Advanced File Functions palette and place it on the block diagram. Refer to Chapter 13, File I/O, of the LabVIEW User Manual for more information about using high-level and low-level or advanced file I/O VIs and functions.
Right-click the file path input terminal and select Create»Constant from the shortcut menu.
Use the Labeling tool to enter the complete path to your file in the path constant. Use the syntax appropriate for your operating system.
Windows A path consists of the drive name, followed by a colon, followed by backslash-separated directory names, followed by the filename. An example is C:\DATADIR\TEST1 for a file named TEST1 in the directory DATADIR on the C drive. You also can drag a path from Windows Explorer and drop it in the path constant.
Macintosh A path consists of the drive name, followed by colon-separated folder names, followed by the filename. An example is HardDrive:DataFolder:Test1 for a file named Test1 in the folder DataFolder on the volume named HardDrive.
UNIX A path consists of slash-separated directory names followed by the filename. An example is /usr/datadirectory/test1 for a file named test1 in the directory /usr/datadirectory.
Wire the refnum indicator to the next File I/O function.