How a file is determined
The +1 is for the newline character.

The byte count equals the number of characters, in this case, because each character takes exactly one byte.  That need not be true in general (see, e.g., UTF-8), but it is for the example you listed.

You didn't write an integer to the file.  You wrote a string -- a sequence of characters, namely the character 1, then the character 2, then 3, then 4, then a newline.  Files don't store integers or other types.  They store a sequence of bytes.  Each character is converted to one or more bytes using an encoding, and then the sequence of bytes is written.