I am working on Windows7 where I have a virtual machine with Ubuntu guest. A shared folder is thrown from W7 to Ubuntu. Ubuntu runs a C ++ script that outputs the results to a file in a shared folder. Well that is something like
outFile << result << std::endl . As a result, for some reason it turns out that there are line feeds in Ubuntu (I look in Vim), but not in Windows (Notepad). How do I make the file display the same in both Vim and Notepad?
Ubuntu has fromdos / todos programs that convert line termination characters.
When opening a file in windows, you can use the binary mode (and in unix it is simply always binary) when \ n is not translated into \ r \ n and then it will be written the same in both systems, and in the program write \ r \ n instead of \ n.
The same binary format, but leave \ n if the programs used in windows already understand.
See the ios :: binary flag in fstream or b in fopen