I have a .txt file containing 100 lines of code. After comparing the size of the file, provided by fseek() and ftell() functions, to the character count, I observed a 198 byte difference in file size – precisely 2x the number of lines (100 lines minus last line), indicating that Windows uses 2 characters to identify each line (confirmed by a trusty Wiki search).
I tried printing out the 2 characters at the end of the line using getc(), but was only able to print out the LF (ASCII code 10) char. The next character is simply the next character in file – no sign of RF anywhere.
Is it possible to access CR char and print it out in terminal?
Are .txt files “better” handled on Linux e.g. using only n ([newline character] – just in case it gets lost in stack overflow formatting) to identify the end of the line?
1