Summary: In this lesson, you will learn how to use the low-level File I/O VI and functions.
| Open/Create/Replace File | - |
|
| Read File | - |
|
| Write File | - |
|
| Close File | - |
|

Time & Dialog palette, at the end of the
VI to determine if the VI ran without errors. Use the error in
and error out clusters in each VI you use or build to pass the
error information through the VI.
file path in the
Open/Create/Replace File VI. However, you can
save time by programmatically wiring the default filename and
path to the VI. Table 1 describes how pathnames
are organized.
| Platform | Pathname |
|---|---|
| Windows |
Consists of the drive name, a colon,
backslash-separated directory names, and the
filename. For example,
c:\testdata\test1.dat is the pathname to
a file named test1.dat in the
testdata directory.
|
| UNIX |
UNIX Consists of forward slash-separated directory
names and the filename. For example,
/home/testdata/test1.dat is the pathname
to a file named test1.dat in the
testdata directory in the
/home directory. Filenames and pathnames
are case sensitive.
|
| Mac OS |
Consists of the volume name (the name of the disk), a
colon, colon-separated folder names, and the
filename. For example, Hard
Disk:testdata:test1.dat is the pathname to a
file named test1.dat in a folder named
testdata on a disk named Hard
Disk.
|
![]() Figure 1 |
Open/Create/Replace File VI opens the file
test1.dat. The VI also generates a
refnum and an error cluster.
refnum associated with that file,
device, or network connection. All operations you perform on
open files, devices, or network connections use
refnums to identify each object.
refnum pass in
sequence from one node to the next. Because a node cannot
execute until it receives all its inputs, passing these two
parameters forces the nodes to run in order and creates a data
dependency. The Open/Create/Replace File VI
passes the refnum and error cluster to the Write
File function, which writes the data to disk. When the
Write File function finishes execution, it passes
the refnum and error cluster to the Close File
function, which closes the file. The Simple Error
Handler VI examines the error cluster and displays a
dialog box if an error occurred. If an error occurs in one
node, subsequent nodes do not execute, and the VI passes the
error cluster to the Simple Error Handler VI.
Comments, questions, feedback, criticisms?
"A full introductory course on programming with LabVIEW."