Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 654279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:28:38+00:00 2026-05-13T22:28:38+00:00

In windows is it possible through an API to write to the middle of

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:28:38+00:00Added an answer on May 13, 2026 at 10:28 pm

    I’m unaware of any way to do this if the interim result you need is a flat file that can be used by other applications other than the editor. If you want a flat file to be produced, you will have to update it from the change point to the end of file, since it’s really just a sequential file.

    But the italics are there for good reason. If you can control the file format, you have some options. Some versions of MS Word had a quick-save feature where they didn’t rewrite the entire document, rather they appended a delta record to the end of the file. Then, when re-reading the file, it applied all the deltas in order so that what you ended up with was the right file. This obviously won’t work if the saved file has to be usable immediately to another application that doesn’t understand the file format.

    What I’m proposing there is to not store the file as text. Use an intermediate form that you can efficiently edit and save, then have a step which converts that to a usable text file infrequently (e.g., on editor exit). That way, the user can save as much as they want but the time-expensive operation won’t have as much of an impact.

    Beyond that, there are some other possibilities.

    Memory-mapping (rather than loading) the file may provide efficiences which would speed things up. You’d probably still have to rewrite to the end of the file but it would be happening at a lower level in the OS.

    If the primary reason you want fast save is to start letting the user keep working (rather than having the file available to another application), you could farm the save operation out to a separate thread and return control to the user immediately. Then you would need synchronisation between the two threads to prevent the user modifying data yet to be saved to disk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to create Windows CE 5.0 images (ie: nk.bin) from VS2005/VS2008 without
Is it possible to write to the windows logs in python?
I'm looking to setup a lightweight, developer only web stack on Windows (and possible
Possible Duplicate: .NET windows application, can it be compressed into a single .exe? To
Is it possible to update IIS on Windows XP from 5.1 to 6? If
Is it possible to embed a windows form within another windows form? I have
Is it possible to configure Windows Servers that reside on the same domain such
Is it possible to target Windows Mobile 6 Professional and Standard from one project?
Is it possible to use an UnhandledException Handler in a Windows Service? Normally I
Is it possible to create a form on Windows using Ruby? I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.