Since all we know in Windows EOL is CRLF and linux LF and CR on Mac. ( more_info )
I want to write a program that reads both linux and Mac, as well as Win files line by line in Windows. To open the file, I will use fopen in "rt" mode, but I do not know how to read lines. fgets reads before CRLF and LF on Windows, but I want it to work for EOL = CR files too.
So what is the solution? Thanks in advance.
c ++ c file newline
Mihran hovsepyan
source share