Reminder - \r\n or \n\r? Reminder - \r\n or \n\r? windows windows

Reminder - \r\n or \n\r?


I'd use the word 'return' to remember, the r comes before the n.


If you are using C# you should use Environment.NewLine, which accordingly to MSDN it is:

A string containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms.


New line depends on your OS:

DOS & Windows: \r\n 0D0A (hex), 13,10 (decimal)Unix & Mac OS X: \n, 0A, 10Macintosh (OS 9): \r, 0D, 13

More details here: https://ccrma.stanford.edu/~craig/utility/flip/

When in doubt, use any freeware hex viewer/editor to see how a file encodes its new line.

For me, I use following guide to help me remember: 0D0A = \r\n = CR,LF = carriage return, line feed