• Advertisement

Archived

This topic is now archived and is closed to further replies.

File editing

This topic is 5513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to overwrite a part of a file with new data, or to delete only a part of a file, without having to recreate the whole file from the ground? Using open, lseek and write, I know I can INSERT data into a file at any location, but I also need to get rid of what was previously in that location!

Share this post


Link to post
Share on other sites
Advertisement
File writes do not insert, but overwrite. Inserting or deleting always involve completely rewriting all the data past the modification point.




[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]

Share this post


Link to post
Share on other sites
You are right, it does overwrite, just as I want. It was a problem with lseek that made me believe otherwise. It works fine now. Thanks.

Share this post


Link to post
Share on other sites

  • Advertisement