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

Format Into File

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Formats 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.

Details  Example

format string specifies how to convert the input arguments. Defaults match the data type of the input arguments. Right-click the function and select Edit Format String from the shortcut menu to create and edit the format string.

This input accepts a maximum of 255 characters.
input file can be a refnum or absolute file path. If it is a refnum, this node opens the file specified by the refnum. This function creates the specified file if it does not already exist. The default is to display a file dialog box and prompt you to select a file.

If you specify an empty or relative path, this function returns an error.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
input 1..n specifies the input parameters to be converted. Each input can be a string path, enumerated type, time stamp, or any numeric data type. You cannot use arrays and clusters with this function.
output file refnum is the refnum of the file that the VI read. You can wire this output to another file function, depending on what you want to do with the file. The default is to close the file if it is referenced by a file path or selected from the file dialog box. If input file is a refnum, LabVIEW assumes that the file is still in use until you close it.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

Format Into File Details

Increase the number of parameters by right-clicking the function and selecting Add Parameter from the shortcut menu or by resizing the function.

You can use this function to determine the order in which the data appears in the file. However, you cannot use this function to append data to a file. To do so, use the Format Into String function and Write Text function or Write File function.

This function converts new lines, or \n, in the format string into the platform-specific end-of-line character, for example, CR/LF on Windows, CR on Mac OS, and LF on Linux. If you do not want to convert the end-of-line character, use the Format Into String function and wire the resulting string output to the data input of the Write File function and set convert eol to FALSE.

Example

Refer to the Format Into-Scan From File VI in the labview\examples\general\functions\File IO directory for an example of using the Format Into File function.


Resources


 

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