Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys.
I'm working with c language.in c language i am using file handling to insert data to middle of the file. file format can be like .txt,.dat,.binary file. plz suggest me easy n understandable code for this topic.
Posted
Comments
CHill60 26-Nov-13 7:38am    
What have you tried for yourself - use the Improve question link to post the code you have so far and indicate where you are stuck
parthdoshi 26-Nov-13 8:02am    
I had tried many time to insert data with help of fseek,ftell function.
Richard MacCutchan 26-Nov-13 8:59am    
Unless you explain what your problems were when using these functions we cannot help you to move forward.

1 solution

To 'insert in the middle of the file', you have to:
  1. Read the file content in a memory buffer.
  2. Modify the memory buffer.
  3. Write back the modified buffer content to the file.

You might find many C file I/O tutorials, just Googling for[^].
 
Share this answer
 
Comments
parthdoshi 26-Nov-13 8:05am    
I had tried many time to insert data with help of fseek,ftell function.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900