Alex Rivera | Logout

How do I insert and delete some characters in the middle of a file?

Asked 2010-03-12T07:14:28.440
10

I want to insert and delete some chars in the middle of a file.

fopen() and fdopen() just allow to append at the end.

Is there any simple method or existing library that allow these actions?

Edit
Report

1 Answer

4

Use fseek function to move the file pointer to the appropriate location of the file and then you can perform a write there. But, for this you should know how many bytes from the end or begining of the file your preferred area for write is.

answered 2010-03-12T07:20:11.987

Your Answer