EOL conversion in notepad ++

That functionality is already built into Notepad++. From the “Edit” menu, select “EOL Conversion” -> “UNIX/OSX Format”. screenshot of the option for even quicker finding (or different language versions) You can also set the default EOL in notepad++ via “Settings” -> “Preferences” -> “New Document/Default Directory” then select “Unix/OSX” under the Format box.

Convert ^M (Windows) line breaks to normal line breaks

Command :%s/<Ctrl-V><Ctrl-M>/\r/g Where <Ctrl-V><Ctrl-M> means type Ctrl+V then Ctrl+M. Explanation :%s substitute, % = all lines <Ctrl-V><Ctrl-M> ^M characters (the Ctrl-V is a Vim way of writing the Ctrl ^ character and Ctrl-M writes the M after the regular expression, resulting to ^M special character) /\r/ with new line (\r) g And do it globally … Read more

Historical reason behind different line ending at different platforms

DOS inherited CR-LF line endings (what you’re calling \r\n, just making the ascii characters explicit) from CP/M. CP/M inherited it from the various DEC operating systems which influenced CP/M designer Gary Kildall. CR-LF was used so that the teletype machines would return the print head to the left margin (CR = carriage return), and then … Read more

What the point of using std::ios_base::binary?

The differences between binary and text modes are implementation defined, but only concern the lowest level: they do not change the meaning of things like << and >> (which insert and extract textual data). Also, formally, outputting all but a few non-printable characters (like ‘\n’) is undefined behavior if the file is in text mode. … Read more

PHP Echo Line Breaks

Use the PHP_EOL constant, which is automatically set to the correct line break for the operating system that the PHP script is running on. Note that this constant is declared since PHP 5.0.2. <?php echo “Line 1” . PHP_EOL . “Line 2”; ?> For backwards compatibility: if (!defined(‘PHP_EOL’)) { switch (strtoupper(substr(PHP_OS, 0, 3))) { // … Read more