Posted by Ryan on .
Why adding only characters to a text file may increase the file's size by several hundred bytes and at other times may not increase the file's size at all?
You are probably looking at the directory listing. Some list them as the real size, some list them as what has been assigned. Operating systems do not assign one byte at a time when the file needs to expand. Space is assigned in blocks, of which a common size is 512 bytes.
So as long as the content of the file does not exceed the last assigned block, the file size does not increase. Once it is exceeded, the operating system will assign an extra block of 512 bytes, thus your observation.