Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

File I/O VIs and Functions

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Use the File I/O VIs and functions to open and close files, read from and write to files, create directories and files you specify in the path control, retrieve directory information, and write strings, numbers, arrays, and clusters to files.

Example

Use the VIs and functions on this palette to perform common I/O operations and other types of file I/O operations. You can read or write various types of data, such as characters or lines in text files, numeric values in spreadsheet text files, or data in binary files.

The File I/O VIs and functions palette and the Advanced File functions palette include functions to control each file I/O operation individually. Use these functions to create or open a file, read data from or write data to the file, and close the file. You also can use the functions to create directories; move, copy, or delete files; list directory contents; change file characteristics; or manipulate paths.

Palette ObjectDescription
Build PathCreates a new path by appending a name (or relative path) to an existing path.
Close FileCloses an open file specified by refnum and returns the path to the file associated with the refnum.
Default Data DirectoryReturns the directory you configure to store the data a VI or function generates.
Format Into FileFormats string, numeric, path, or Boolean data as text and writes the text to a file. This function does not work for files inside an LLB.
Open/Create/Replace FileOpens an existing file, creates a new file, or replaces an existing file, programmatically or interactively using a file dialog box. This function does not work for files inside an LLB.
Read from Binary FileReads binary data from a file and returns it in data. How the data is read depends on the format of the specified file. This function does not work for files inside an LLB.
Read From Measurement FileReads data from a text-based measurement file (.lvm) or binary measurement file (.tdm or .tdms).
Read From Spreadsheet FileReads a specified number of lines or rows from a numeric text file beginning at a specified character offset and converts the data to a 2D, double-precision array of numbers, strings, or integers. You must manually select the polymorphic instance you want to use.
Read from Text FileReads a specified number of characters or lines from a byte stream file. This function does not work for files inside an LLB.
Scan From FileScans text in a file for string, numeric, path, and Boolean data, converts the text to a data type, and returns a duplicated refnum and the converted outputs in the order scanned. This function does not work for files inside an LLB.
Strip PathReturns the name of the last component of a path and the stripped path that leads to that component.
Write to Binary FileWrites binary data to a new file, appends data to an existing file, or replaces the contents of a file. If a path is wired to the file (use dialog) input, the function opens or creates the file before writing to it and replaces any previous file contents. If a file refnum is wired to the file (use dialog) input, writing begins at the current file position. To append to an existing file, set the file position to the end of the file by using the Set File Position function. This function does not work for files inside an LLB.
Write To Measurement FileWrites data to text-based measurement files (.lvm) or binary measurement files (.tdm or .tdms).
Write To Spreadsheet FileConverts a 2D or 1D array of strings, signed integers, or double-precision numbers to a text string and writes the string to a new byte stream file or appends the string to an existing file. The data type you wire to the 2D data input or 1D data input determines the polymorphic instance to use.
Write to Text FileWrites a string of characters or an array of strings as lines to a file. If you wire a path to the file input, the function opens or creates the file before writing to it and replaces any previous file contents. If you wire a file refnum to the file input, writing begins at the current file position. To append to an existing file, set the file position to the end of the file by using the Set File Position function. This function does not work for files inside an LLB.


SubpaletteDescription
Advanced File VIs and FunctionsUse the Advanced File VIs and functions to manipulate files, directories, and paths.
Configuration File VIsUse the Configuration File VIs to create, modify, and read a platform-independent configuration file.
File ConstantsUse the file constants with the File I/O VIs and functions.
Storage VIsUse the Storage VIs to read and write waveforms and waveform properties to binary measurement files (.tdm).
TDM Streaming VI and FunctionsUse the TDM Streaming VI and functions to read and write waveforms and waveform properties to binary measurement files (.tdms).
Zip VIsUse the Zip VIs to create new zip files, to add files to zip files, to unzip zip files, and to close zip files.

Example

Refer to the Using Spreadsheet Format VI in the labview\examples\file\sprdsht.llb for an example of using the File I/O VIs and Functions.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit