I see two different questions:
- What happens if the power is cut in the middle of a write?
There is no guarantee what happens on a power cut -- you could even lose the entire filesystem.
However, there are typical behaviors. If the filesystem is allocating new blocks for the written region, the filesystem metadata for the new blocks may not be written when the power is cut and the file may be lost or truncated. However, if you are writing to the middle of the file and the blocks are already allocated, it should be fine, but there is no guarantee how much of that write made it to disk. Could be some, all, or none.
As noted in comments, behavior may differ here for special filesystems like CoW or network filesystems. Journaled filesystems make an attempt at making recovery from issues like this more graceful. Also, raid arrays typically have buffering hardware that can hold incomplete writes across a power outage.
- What happens if the process is killed in the middle of a write?
There are two cases here. If you mean write(2) system call, this is mostly atomic, and it may complete before the process is actually killed, or it may not start at all. In some cases, the write may be interruptible, but usually not.
If you mean a library call such as fwrite(3) using stdio buffering, then the process may have unwritten buffered data that will not be written when the process is killed. Typically stdio buffers data to disk in blocks; when the buffer has complete blocks, it calls write(2).