Scanning a File for Data

Scanning a file for data pulls expected data from a text file and formats the data for use with another VI or function.

Complete the following steps to scan a file for data.

  1. Open a reference to a text file.
  2. Select the Scan From File function on the Functions»File I/O palette and place it on the block diagram.
  3. Use the Positioning tool to expand the Scan From File function to include the number of data outputs necessary for the data you expect. For example, if you expect to extract a string, two numbers, and a Boolean value from the file, expand the function to include four outputs.
  4. Wire a file refnum to the input file input of the Scan From File function.
  5. Format the strings in the format string input of the Scan From File function to set the outputs to the data type you expect. You must have one format specification for each output.
  6. Wire the outputs of the Scan From File function to a VI(s), function(s), or indicator(s).
  7. Run the VI.