This occurs as a programming language independent problem to me.I have a file with the contentaaabdddWhen I want to insert C behind b then my code needs to rewrite ddd to getaaabCdddWhy can I not just insert C at this position?I can not do this in Java, Python, ... . I can not do this in Linux, Windows, ... . Am I right?I do not understand why C can't simply be inserted without the additional writes.  Would someone please explain why this is so?
Why can we not insert into files without the additional writes? (I neither mean append, nor over-write)
programming languages;operating systems;file systems;files
Given that most file systems store the contents of files in individual blocks that are not necessarily contiguous on the physical disk, but linked via pointer structures, it seems that such a mode - inserting rather than appending or overwriting - ought to be possible, and could certainly be made more efficient than what we have to do now: read the entire content, edit the stream of bytes and re-write the entire content.However, for better or worse, the UNIX semantics of file systems were designed along the rough and simple paradigm in the 1970s: it allows you to do everything, but not necessarily in the most efficient way possible. Nowadays it is almost unthinkable to introduce a new file opening mode into the Virtual File System layer and have any hope of the major file systems adopting support for it. This is a pet peeve of mine, but unfortunately one unlikely to be resolved any time soon.