Writing to the middle of the file (without overwriting data)

Posted by Andreas Bonini on Stack Overflow See other posts from Stack Overflow or by Andreas Bonini
Published on 2010-03-07T21:53:32Z Indexed on 2010/03/08 15:06 UTC
Read the original article Hit count: 224

Filed under:
|
|

In windows is it possible through an API to write to the middle of a file without overwriting any data and without having to rewrite everything after that?

If it's possible then I believe it will obviously fragment the file; how many times can I do it before it becomes a serious problem?

If it's not possible what approach/workaround is usually taken? Re-writing everything after the insertion point becomes prohibitive really quickly with big (ie, gigabytes) files.


Note: I can't avoid having to write to the middle. Think of the application as a text editor for huge files where the user types stuff and then saves. I also can't split the files in several smaller ones.

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows