filenotepadwordpad

Same file: different when opened with notepad vs. wordpad


Was accessing a file in a code with both C# and C++. When file is opened in notepad it looks like this (one integer at left and the rest of numbers are double):

enter image description here

But the same file when opened with WordPad looks like this (one integer next to each double):

enter image description here

Why do they look different?


Solution

  • It has to do with the way that newlines are encoded in your file. Windows recognizes a newline as consisting of two characters (\r\n) whereas some other operating systems, namely Unix-based ones, use only \n or \r. WordPad is smart enough to recognize both newline types, but Notepad is not.