i have a file which contains 332 characters determined by using the document statistics feature of gedit, but actually its file size on disk is 333 bytes from ls -lh output ? so, what is the reason ? At first glance,it seems related to the EOFcharacter at the end of file which adds one more to the file size,well,from the
it turns out that the extra byte is 0a,and i also have a discovery that if you open gedit or nano text editor,type character '1' and '2' ,save the file as haha or any name you like. use the command cat haha | od -x,and you will see
0000000 3231 000a
0000003
i make sure that i did not press the enter key,but always there is an extra 0a byte,a line feed character looked up from the ascii character map. i really want to know the reason.
Most editors will add the newline character (0xA) to the end of the file. BTW, there is no EOF character; EOF is returned from file reading functions when they detect the end of the file.