Chapter 2 Formatting and I/O Library
© National Instruments Corporation 2-21 LabWindows/CVI Standard Libraries
Parameters
Input fileName string Pathname.
read/writeMode integer Read/write mode.
action integer File pointer reposition location.
fileType integer ASCII/binary mode.
Return Value
handle integer File handle to be used in
subsequent ReadFile/WriteFile
calls.
Return Code
-1 Function failed, unable to open file, or bad argument
to function.
Parameter Discussion
fileName is a pathname specifying the file to be opened. If the read/writeMode argument is
write or read/write, this function creates the file if it does not already exist. If a file is created, it
is created with no protection; that is, both reading and writing can be performed on it. Use the
function GetFileInfo if it is necessary to determine whether a file already exists.
read/writeMode specifies how the file is opened:
•VAL_READ_WRITE = open file for reading and writing
•VAL_READ_ONLY = open file for reading only
•VAL_WRITE_ONLY = open file for writing only
action specifies whether to delete the old contents of the file, and whether to force the file
pointer to the end of the file before each write operation. action is meaningful only if
read/writeMode = write or read/write. After read operations are performed, the file pointer
points to the byte following the last byte read. action values are as follows:
•VAL_TRUNCATE = truncate file (deletes its old contents and positions the file pointer at the
beginning of the file.
•VAL_APPEND = do not truncate file (all write operations append to end of file).
•VAL_OPEN_AS_IS = do not truncate file (positions the file pointer at the beginning of the
file. )