I've been trying to make a swear filter for text documents where the program takes in strings at the command line and the text file but I am having problems figuring out how to do it.
Example application: (random words instead of swears)
filter.out i you me < filter.txt
filter.txt:
i love you, you hate me
from me
Output:
love hate
from
I understand how to print to files using fprintf and how to read and print out a file on its own. But how do I read it, remove the words I want and continue printing the file? I cant seem to figure it out. I'm using strncmp to try and compare, but once I compare them, I dont know how to replace it in the file.