You are on page 1of 4

File I/O VIs and Functions

Table of Contents
LabVIEW 2012 Help Edition Date: June 2012 Part Number: 371361J-01 View Product Info Requires: Base Package. This topic might not match its corresponding palette in LabVIEW depending on your operating system, licensed product(s), and target. 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 Object Build Path Close File Format Into File Description Creates a new path by appending a name (or relative path) to an existing path. Closes an open file specified by refnum and returns the path to the file associated with the refnum. Formats string, numeric, path, or Boolean data as text and writes the text to a file. If you wire a file refnum to the file input, writing begins at the current file position. To append to an existing file, open the file and set the file position to the end of the file by using the Set File Position function. Otherwise, the function will open the file and write to the beginning of the file. This function does not work for files inside

an LLB. Open/Create/Replace File Opens 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.

Preallocated Read from Reads binary data from a file and places the data into Binary File an array that you have already allocated without incurring a copy of the data. Unlike the Read from Binary File function, this function avoids run-time memory allocations. Read from Binary File Reads 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. Reads data from a text-based measurement file (.lvm) or binary measurement file (.tdm or .tdms). Reads 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, doubleprecision array of numbers, strings, or integers. You mustmanually select the polymorphic instance you want to use. Reads a specified number of characters or lines from a byte stream file. This function does not work for files inside an LLB. Scans 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. Returns the name of the last component of a path and the stripped path that leads to that component. Writes binary data to a new file, appends data to an existing file, or replaces the contents of a file. This function does not work for files inside an LLB.

Read From Measurement File Read From Spreadsheet File

Read from Text File

Scan From File

Strip Path Write to Binary File

Write To Measurement Writes data to text-based measurement files File (.lvm) or binary measurement files (.tdm or .tdms). Write To Spreadsheet Converts a 2D or 1D array of strings, signed integers,

File

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. Wire data to the 2D data input or 1D data input to determine the polymorphic instance to use or manually select the instance. Use this VI to transpose or separate data. Note To format with Microsoft Excel, use ActiveXwith LabVIEW or the Report Generation Toolkit for Microsoft Office. Writes a string or an array of strings as lines to a file. This function does not work for files inside an LLB.

Write to Text File

Subpalette Advanced File VIs and Functions Configuration File VIs File Constants Storage/DataPlugin VIs

Description Use the Advanced File VIs and functions to manipulate files, directories, and paths. Use the Configuration File VIs to create, modify, and read a platform-independent configuration file. Use the file constants with the File I/O VIs and functions. Use the Storage/DataPlugin VIs to read measurement data from a variety of file formats, write data to.tdm or .tdms files, or manage DataPlugins installed on the local computer. You must download appropriate DataPlugins and register them on the local computer before you can access the corresponding file formats. Refer to the National Instruments Web site at ni.com/dataplugins to download DataPlugins. Refer to the NI Developer Zone at ni.com/zone for information about using the Storage/DataPlugin VIs with an ASAM-ODS database. Copyright: (c) 2012 National Instruments. All rights reserved. Use the TDM Streaming VIs and functions to read and write waveforms and waveform properties to binary measurement files (.tdms). Use the XML VIs and functions to manipulate XML data. Use the Zip VIs to create new zip files, to add files to zip files, to unzip zip files, and to close zip files.

TDM Streaming VIs and Functions

XML VIs and Functions Zip VIs

You might also like