LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert eol - exactly what does it mean?

Hi all,

 

I am writing ascii characters to file, reading the file and updating it at intervals in my application.  I am having troubles after I update the file (write) in that it becomes unreadable.

 

I have checked the Convert EOL setting on the read text file vi and it works sometimes.  However, I am reading and writing all the time.  I have tried checking Convert EOL for the write text file vi as well.  This doesn't seem to work. 

 

Should I be writing with Convert EOL unchecked and reading with Convert EOL checked?

 

Most of the threads in this forum indicate that Convert EOL should be unchecked.  I have not seen any detailed explanations of exactly what Convert EOL means.  What does it mean?

 

My application and text files need to be compatible for numerous Windows platforms including 2000/XP and Vista.

 

Also, could I avoid this issue of Convert EOL by using the write and read Binary file vi's?  Are they suitable for ascii characters (text)?

 

Thanks,

 

Battler.

0 Kudos
Message 1 of 9
(10,555 Views)

one way is to concatenate EOL symbol with your string and then write this new string to your file.
Now it can be like


EOL"your string". (or "/nyour string" )


EOL symbol and "Concatenate strings.vi"

0 Kudos
Message 2 of 9
(10,533 Views)

Hi battler,

 

"I am having troubles after I update the file (write) in that it becomes unreadable"

Which way "unreadable"? Can't the file be opened for reading? Is the text screwed up? Example?

 

"I am reading and writing all the time"

Is there any order for read/write accesses? Do you overwrite existing text? Do you use proper "SetFilePosition"? Do you append to file?

 

"any detailed explanations of exactly what Convert EOL means"

"Convert EOL" will convert any EOL char combination to the type of EOL that is supported by the current OS

 

"compatible for numerous Windows platforms "

For Windows the EOL setting didn't change so far, hence uncheck "Convert EOL".

 

"could I avoid this issue of Convert EOL by using the write and read Binary file vi's?  Are they suitable for ascii characters (text)?"

Yes. Yes.

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 9
(10,525 Views)

Hello battler,

It is difficult to speculate the root cause of the problem with the information given.  What exactly is not working on the Read from Text File function?  Does it output the wrong text?  Does it output nothing?  Does an error occur?  An example VI with a description of the unexpected behavior would be really useful here.

With regards to the EOL option, the Help for the Read from Text File Function states that the function will convert all platform-dependent EOL characters to a line feed unless the option is unchecked. 

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 4 of 9
(10,491 Views)

Thanks GerdW.  Kudos!

 

I understand that since my application is only going to be deployed to Windows machines and they all use the same kind of EOL character set then I do not have to worry about any EOL conversion (i.e. it should always be switched off).  Correct?

 

The problem was that the default when you use one of these text file VIs I believe is EOL conversion turned ON.  The app I was having a problem with was a conversion from a previous version of LV which had other text file VIs with EOL turned OFF.

 

The combination of file vis with EOL ON and OFF caused the problem.  I have made sure that all VIs have EOL OFF and it works fine.  BTW it is difficult to know (to remember) to right click the VIs to turn EOL off, since it is no longer in the VI documentation.

 

I am still tentative about using the binary file VIs to read and write text.  The text doesn't need to be readable by humans.

 

Say for instance I write the character 'A' to a binary file then read it back and do a simple string search for the character 'A'.  Does that work?

 

If I get the time I'll try it.

 

Cheers,

 

Battler.

0 Kudos
Message 5 of 9
(10,473 Views)

Hi battler,

 

you can always exchange your "write to text file" with "write to binary file" - as long as the written content stays the same you get the same file content, i.e. human readable ASCII text...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(10,469 Views)

HI, I'm reading files using labview, and i'm using some characters, of that file, as input to case structure (string). The problem is the EOL, for example, the prarameter of my case structure is "VDC", but, from my file comes "VDC/n", so  the case structure will never function. Is there any way to eliminate this EOL? I tried to mark the option CONVERT EOL, but in this situation just the \r is eliminated, the \n remains there. Nowadays i'm using the function match patter and picking the text before \n. But i think that is a stupid solution!!

 

Any help will be welcome!

0 Kudos
Message 7 of 9
(10,261 Views)

Use the Trimwhitespace.VI in the strings pallette.

 

Cheers,

 

Battler.

 

 

0 Kudos
Message 8 of 9
(10,257 Views)
Thank you so much!!
0 Kudos
Message 9 of 9
(10,253 Views)
Products may include a surcharge. Surcharge is calculated during checkout for U.S. customers. Learn more