The difference between Linux and Windows line breaks

Problem background:

The data set was made under Windows, and the time stamp of the picture file was saved in .txt format as the picture file name. However, when running ORB-SLAM3 in the Linux environment, an error occurred when loading the picture file name according to the time stamp. After debugging and analysis, It is found that the newline character in the two systems is different, which causes the file name to be read incorrectly. Here is a record of the problem and the solution.

The difference under different systems

  • Linux operating system: LF, corresponding to\n
  • Windows operating system: CR LF, corresponding to \r \n
  • Mac OS: CR, corresponding to \r

conversion method

The conversion of line breaks can use Notepad++ or VSCode.

Notepad++

Use Notepad++ to open the file, find in the lower right corner:
Notepad++ interface
double-click directly, the following options will appear, and convert according to your own needs.
insert image description here

VSCode

Open the file in VSCode,
insert image description here
click the option in the red box in the lower right corner, and the following picture will appear on the top of the software interface:
insert image description here
convert as needed. (It seems that VSCode does not support the conversion of Mac system CR line breaks...)

Guess you like

Origin blog.csdn.net/hypc9709/article/details/128813041