The file system writes the number of bytes in the file, and all bytes can have any value - no specific character / byte value is a reserved inquiry value, meaning the end of the file. That way you can have NUL anywhere in the file, but you don't have to mark it.
Each line of a text file really needs to be completed with a line feed, ASCII 10 dec, 0A hex (on Windows, this will be an ASCII 13 dec carriage return followed by a line). If you create an empty ala echo > filename , it will have one line output, but only because by default the echo prints an empty line. If you used touch filename , it would be completely empty.
When you cat > filename and enter things into the terminal / console window, you end up using Control-D to run the end of file condition (for Linux / Control-Z in DOS), but this character is not stored in the file itself.
source share