Hello dear colleagues, I’m actually having trouble about the newline format to use in a string while using the FILE_WRITE function. Here is the way i use all the FILE_* functions : And here is how my string input looks like :
I tried to used a multiple newline format like "\ ", "\ \ ", " " , “,\ ,” but i still don’t have any newline in my CSV file:
Do you have any idea of what i’m doing wrong ? Thanks in advance for your reply. Best regards.
Hello, Something like the below should work. The trick is to to use the “C” formatter to format ASCII codes as the corresponding control characters. Note that you will not see these control characters when viewing the String variable in PLCnext Engineer debug mode - not even a placeholder. So it may seem like these control characters have not been inserted into the string. But you should find that they are there in your CSV file. Hope this helps. ~ Martin.
It works for me ! Thanks for your reply.
Hi Martin,
I can not see the image here. I guess the link on the page is broken. Could you please answer here with a peace of code regarding this issue?
I am also trying to add a new line into a .txt file and I did not get the solution.
Thank you very much!
Sorry about the missing images (those disappeared when this website was upgraded).
In the next release of PLCnext Engineer (version 2022.6) you will be able to use the backslash as an escape character, like the original poster in this thread was expecting.
e.g.\
`` or\Nin a STRING will be interpreted as a newline character.
In version 2022.3 and earlier, you can use the TO_STRING function to generate a control character from an ASCII code, e.g.:
TO_STRING(BYTE#0C, '{0:c}');… and then Concatenate these control characters to the remainder of the string.