Operating systems have different ways on treating on line break symbols. But what exactly is a carriage return? In some operating systems like Mac OS, carriage returns also have line breaks embedded with them. Carriage return means going to move the position of the cursor to the first position on the same line. In programming languages we often see this character \r. While a line break’s character is \n, other operating systems like Windows actually combine both \r\n to denote a next line (and a carriage return). Notice the ENTER key’s symbol on the keyboard? the direction is first going down, then the arrow points to left which indicates the cursor would be on the first position of the next line. Here is a list of 3 famous operating systems and how they handle line breaks.

Windows = \r\n
Unix = \n
Mac OS = \r

Related Posts Plugin for WordPress, Blogger...