File wrap problem under linux

  
 

\ \ can be \ is a newline \ is a carriage return

The newline character in windows is \ \ , and \ under linux/unix. Where \ =0x0d represents a carriage return and \ =0x0a represents a line feed. The early computer output device was not a display, but a teletypewriter, and the structure was similar to that of a normal typewriter. There is a printhead that is typed on paper and a motor that controls the entry and exit of the paper. When the print head reaches the end of the line, two actions are required to reach the beginning of the next line: first, the carriage return action is performed, the print head is moved to the beginning of the line, and then the line feed is performed, and the motor moves the paper up one line. So that the printhead is at the beginning of the next line and you can continue printing. The control characters corresponding to carriage return and line feed are \ and \ respectively, which is the origin of the newline character in \ \ in windows. Later, because of the continuous execution, the two control characters are reduced to a control character in the printer. This is the origin of the newline \ in linux/unix.


When you make a log file, it is confusing to open the file written by printWriter on Windows, because the line break written in the printLn method under Linux is \ . Can't recognize \ \ in windows to be considered a newline

Copyright © Windows knowledge All Rights Reserved