C语言文件编程 - 使用POSIX调用的文件替换文本 [英] C File Programming - Replace a text in a file using POSIX Calls

查看:76
本文介绍了C语言文件编程 - 使用POSIX调用的文件替换文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法来取代使用POSIX调用一个文本文件中任何关键字,而无需重新创建该文件..
如果是的话请告诉我该怎么做..

Is there a way to replace any keyword in a text file using POSIX calls, without re creating the file.. If yes Please tell me how to do it..

在此先感谢..

推荐答案

如果文字和更换都一样大小,然后你可以用模式下打开它 R + ,求,然后写。如果它们的大小不同,那么有没有办法不用重新更换。

If the text and the replacement are the same size then you can open it with mode r+, seek, and then write. If their sizes are different then there is no way to replace without recreating.

这篇关于C语言文件编程 - 使用POSIX调用的文件替换文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆