如何在一个文件的中间插入和删除一些字符? [英] How do I insert and delete some characters in the middle of a file?
本文介绍了如何在一个文件的中间插入和删除一些字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要插入,并在文件的中间删除一些字符。
I want to insert and delete some chars in the middle of a file.
fopen()和fdopen()只允许在最后追加。
fopen() and fdopen() just allow to append at the end.
有没有让这些行动的任何简单的方法或现有的库?
Is there any simple method or existing library that allow these actions?
推荐答案
有没有简单的方法。你必须做手工。例如:
There is no simple method. You have do it manually. For example:
- 读取块你想之前插入到内存
- 寻求着新的位置
- 写块你只是在新的位置读
- 寻求回哪里要插入
- 写入新的数据。
这篇关于如何在一个文件的中间插入和删除一些字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文