Owning Palette: File I/O VIs and Functions
Requires: Base Development System
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.If you want to use the Read from Binary File function to read the array or string data you write to file, the prepend array or string size? parameter must indicate TRUE. Otherwise, LabVIEW generates an error.
|prepend array or string size? indicates whether LabVIEW includes data size information at the beginning of the file when data is an array or string. If prepend array or string size? is FALSE, LabVIEW does not include the size information. The default is TRUE. prepend array or string size? controls only the top-level data size information. Arrays and strings in hierarchical data types such as clusters always include size information.|
|prompt is the message that appears above the list of files and directories, or folder, in the file dialog box.|
|file can be a refnum or absolute file path. 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. 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.
|data contains the data to write to the file and can be any data type.|
|byte order sets the endian form of the resulting data. Byte order, or endian form, indicates whether integers are represented in memory from most-significant byte to least-significant byte or vice versa. The function must read the data in the same byte order that the data was written.
|error in describes error conditions that occur before this node runs. This input provides standard error in functionality.|
|refnum out is the refnum of the file that the function 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 file is a refnum or if you wire refnum out to another function, LabVIEW assumes that the file is still in use until you close it.|
|cancelled is TRUE if you cancel the file dialog box. Otherwise, cancelled is FALSE, even if this function returns an error.|
|error out contains error information. This output provides standard error out functionality.|
Refer to the Simple Binary File.lvproj in the labview\examples\File IO\Binary\Simple Binary directory for an example of using the Write to Binary File function.