07-11-2013 04:53 PM
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.
Solved! Go to Solution.
07-11-2013 05:00 PM - edited 07-11-2013 05:01 PM
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.
07-11-2013 05:03 PM
Ha, I didn't think to do it on the read too. That worked. Thanks.