How each file system stores its files depends on the file system, not on the immediate implementation of fopen
. It would be strange to see a system that has to relocate the entire file in order to extend it. Files are typically stored in "slow" storage, which means that the entire design of the file system is dedicated, among other things, to making such operations as extending files as efficient as possible under "slow storage" conditions.
A popular, most straightforward approach to storing files in a file system (think FAT) is to organize files as sequences of disk "blocks" of some pre-determined size. When you write new data to the end of the file, it is written into the last block until it becomes full. After that a new block is allocated somewhere in storage and appended to the end of the file. And so on. Obviously, this might easily result in multiple files having their blocks stored in interleaved fashion, i.e. physically these files are stored non-contiguously. This adversely affects input/output performance, but this is considered an acceptable price to pay for fairly good file extension performance.
In other words, the file does not get recreated or relocated. It simply gets extended at the end.