C File Programming - replace text in a file using POSIX calls

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

Thanks in advance.

0
source share
1 answer

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

+1
source

Source: https://habr.com/ru/post/1332892/


All Articles