Example Code

Parse Text File to Line-by-Line String Array

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example will read a text file and return each line of the text file in an array of strings.


Description: VI read user defined text file and return requested separate lines of the file in an array of strings.


Requirements

LabVIEW 2012 (or compatible).


Steps to Implement or Execute Code:

1. Set a file path
2. Set the number of first lines to read
3. Run VI


Additional Information or References:

 

Parse Text File to Line-by-Line String Array FP.png

 

Parse Text File to Line-by-Line String Array sn.png

 

 

Notes:

This will not work with all file types, just text files (txt, bat).


 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.