LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I indicate end-of-line in a text file

I am trying to get a labview VI to launch a VI whose path is written in a text file. How do I indicate the end of line so that the VI stops reading the line when it encounters a certain character (say $). The file has only one line in it. I need to do this because the previous file write to the text file causes white spaces to be inserted after the path and this causes a file reading error.
0 Kudos
Message 1 of 2
(3,066 Views)
Several comments :

1- is there any reason to have blank chars inserted after the path ? Seems that you already have a problem there. If possible, try to solve the problem at the source
2- the end of line char is usually CR (Carriage Return, aka ASCII char 13 = $0D = Control-D). But LF (Line Feed = 10 = $0A = control-A) is also used (platform dependent). In LV, you can use the "Concatenate strings" function to add/insert control chars (found in the String Control Palette). However, this will not solve your problem of unwanted added blank chars at the end of your string.
3- you can use the Trim white space.vi (in the "Additionnal string functions" sub-palette) to remove ALL the spaces in your string
4- you can build your own "end space remover" function. :
reverse the string, wire to a "Match pattern" function, use " +" (space + "+") to search for any number of spaces, reverse again the "after substring".
5- there is no point 5 🙂

You may find interesting description of ASCII chars here
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 2
(3,066 Views)