'Line break' for a .txt file in command line
Solved
Skiio
Posted messages
309
Status
Member
-
Skiio Posted messages 309 Status Member -
Skiio Posted messages 309 Status Member -
Hello everyone,
So here it is, I have a problem. I am using programming software and I need to code in ST (Structured Text), but no matter the type of coding, it's the same issue in C.
I want to create a .txt file with various position data like X, Y, Z.
That's not the problem for now; the issue is the same across applications.
When I want to 'line break' in my code, I have a problem with .txt files. I use a STRING variable to perform a line break, so I use the code '$N', but when I open my .txt file with Notepad, the 'line breaks' do not occur. However, if I open this .txt file with Notepad++, it works.
For my application, I import this .txt file into a CAD software to create a sort of 'Point Cloud', but my software does not detect the '$N' either. It reacts just like Notepad.
If I manually force the 'line breaks' in Notepad, it then works in my software, but this is really tedious and not what I want to do (Industrial Application, so no 'quick fixes').
Do you know a solution to my problem?
P.S.: I am attaching a 'TYPE' file to show you the results in Notepad and Notepad++.
Configuration: Windows Vista
--
I will remain convinced that a man cannot live without ... beers.
So here it is, I have a problem. I am using programming software and I need to code in ST (Structured Text), but no matter the type of coding, it's the same issue in C.
I want to create a .txt file with various position data like X, Y, Z.
That's not the problem for now; the issue is the same across applications.
When I want to 'line break' in my code, I have a problem with .txt files. I use a STRING variable to perform a line break, so I use the code '$N', but when I open my .txt file with Notepad, the 'line breaks' do not occur. However, if I open this .txt file with Notepad++, it works.
For my application, I import this .txt file into a CAD software to create a sort of 'Point Cloud', but my software does not detect the '$N' either. It reacts just like Notepad.
If I manually force the 'line breaks' in Notepad, it then works in my software, but this is really tedious and not what I want to do (Industrial Application, so no 'quick fixes').
Do you know a solution to my problem?
P.S.: I am attaching a 'TYPE' file to show you the results in Notepad and Notepad++.
Configuration: Windows Vista
--
I will remain convinced that a man cannot live without ... beers.
1 answer
-
Hello,
There are different line break characters
For Windows, it is recommended to use the combination \r\n
\r = CR (Carriage Return) // Used as a new line character in Mac OS before X
\n = LF (Line Feed) // Used as a new line character in Unix/Mac OS X
\r\n = CR + LF // Used as a new line character in Windows
--
Best regards,
Jordane