Re: WriteFile, insert data in the middle of the file.
- From: "AliR" <AliR@xxxxxxxxxxxxx>
- Date: Mon, 07 Nov 2005 21:23:27 GMT
Well you answered your own question. There is no way to write to the middle
of the file without overwriting what's already there. In other word, you
can't expand a file in the middle.
What most programs do is create a temp file write everything they want to
that, then simply delete the old file and rename the temp file to the
correct filename.
AliR.
"wk" <wk@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:95B74BD6-9C73-4150-BFF3-7694D337CA8D@xxxxxxxxxxxxxxxx
> Hello,
>
> What I want to do is to insert data (not overwrite existing data) in the
> middle of a big file. Does WriteFile( ) have this option?
>
> If there's no way to insert data in the middle, I guess I have to read out
> all the data from the insertion point, and append my new data, and write
them
> back to the file? Isn't this too inefficient? Anybody knows how OS handles
> this kind of "insert in the middle" scenario?
>
> Thank you, I appreciate your opinion.
>
> wk
>
.
- Prev by Date: Re: Is there a way to change the return value for and ON_CONTROL() handler to return 0
- Next by Date: Printing Question
- Previous by thread: Custom base class for dialog - inheritance problems
- Next by thread: Re: WriteFile, insert data in the middle of the file.
- Index(es):
Relevant Pages
|