Complete the following steps to read characters or strings from a text file.
- Add a string indicator to the front panel.
- Add the Read from Text File function to the block diagram.
- Right-click the file input of the Read from Text File function and select Create»Constant. A path constant appears. Enter an absolute path for the file you wish to read from into the constant.
Tip To avoid typing out the path, you can drag a file from the desktop and drop it into the constant.|
- Wire the text output of the Read from Text File function to the string indicator.
- Run the VI. The VI reads the text from the file you specified in the constant and displays the text in the front panel string indicator.
Refer to the Read from Text File VI in the labview\examples\file\smplfile.llb for an example that reads data from a text file and plots the data.