LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with end of line in text file.

Solved!
Go to solution

Using LabVIEW 2010 on W7 64 bit in the USA.

I have an application in which I'm writing to a text file.  I'm using the "Write to Text File" function to write the text, and the "Read from Text File" function to read it back.  My problem is with the end of line character.  The text that I'm writing is one long string, not an array of strings.  While building this string, I insert the EOL constant from the strings function palette to indicate a new line is next.  My testing has shown this EOL constant to be consecutive byte values 13 and 10.  After writing all the text to a file, I can open the file with Notebook, or Word, or whatever, and it displays correctly.  When I read it back with the Read from Text File function, I attempt to parse the string by looking for the same EOL constant, but it doesn't work.  Closer examination of the string read from the file reveals that the EOL value has been modified to just 10.  The byte location for 13 is gone.  I know there is a note about the Write to Text File function modifying/adding EOL characters that are system defaults, but the note specifically states arrays.  I'm manually putting the value in the string.  Does anyone know why this would happen and how to fix it?

Thanks.

 

0 Kudos
Message 1 of 3
(4,005 Views)
Solution
Accepted by topic author rickford66

From the help of the Read From Text File Function


The function converts all platform-dependent end-of-line characters to line feed characters unless you right-click the function and remove the checkmark next to the Convert EOL shortcut menu item.


 

Right-click your read and uncheck the Convert EOL.  I recommend doing the same to your Write to Text File function.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3
(4,004 Views)

Ha, I didn't think to do it on the read too.  That worked.  Thanks.

0 Kudos
Message 3 of 3
(4,000 Views)