I have a text file which has a size of 18 bytes.
The text file contains
1 2 3
ABCDEFG
HIJ
KLMN
I was wondering why it has 18 bytes instead of 17?
I tried to create a program that will show the Integer value of each characters, and it shows that there are two new line characters (Int: 10, '\n')
Just like this.
1 2 3 4 5 6 7 8
A B C D E F G \n \n
0 1 2 3 4 5 6 7 8
H I J \n \n
9 10 11 12 13
K L M N [EOF]
14 15 16 17 18
Does the program that prints the integer value of each character open the file in binary mode? I don't think tellg() and seekg() works very well in text mode, if that's what you're using.
so i tried to open it in binary mode, and it display 13 and 10 on position 7,8,12 and 13
So it's really \r\n... Why does it only work well in binary mode?