Monday, June 11, 2007

ODOA - Or how lines are ended

This is not a strict Ubuntu issue but a general issue concerning operating systems and protocols.

Unix uses newline (or linefeed, '\n' = 012 = 0x0A) to terminate lines in text files;
DOS uses carriage return + linefeed ("\r\n" = 015 + 012 = 0x0D + 0x0A), and (AFAIK)
MacOS uses only carriage return ('\c'
= 015 = 0x0D).

Or...

Unix = 0x0A
DOS = 0x0D 0x0A
TCP = 0x0D 0x0A
Mac = 0x0D

Read more at: http://en.wikipedia.org/wiki/Line_feed#Newline_in_programming_languages

Note that \n in the C-language is dependant of the underlaying OS and operational mode for opened files.

No comments:

Post a Comment