Posted 02 May 2018 - 04:52 PM
Hello!
I want to make a program, which you execute like textreplacer originalfile.rf replacedfile.
replaced file doesn't exists, only originalfile. Original file contains something like:
This is a text to be replaced.
The program now copies the file to the second argument (replacedfile), but also replaces all text elements I (as the developer of the program) specified to be replaced. So the end product should look like this:
This is a text which was replaced.
So, I specified that to be will be replaced with which was.
My questions are:
- How can I make the text be replaced in the copy?
- How can I make the first file (the file to be copied) need to have a specific ending (like .rf), so the file must be *.rf. (Not the second file/argument)
If you don't understand what I mean:
The things above are just examples; I want to make something like my own programing language where files have to have a specific file extension. You can run the program now and it compiles it to runable lua. The output file doesn't have to have a specific extension.
I want to make a program, which you execute like textreplacer originalfile.rf replacedfile.
replaced file doesn't exists, only originalfile. Original file contains something like:
This is a text to be replaced.
The program now copies the file to the second argument (replacedfile), but also replaces all text elements I (as the developer of the program) specified to be replaced. So the end product should look like this:
This is a text which was replaced.
So, I specified that to be will be replaced with which was.
My questions are:
- How can I make the text be replaced in the copy?
- How can I make the first file (the file to be copied) need to have a specific ending (like .rf), so the file must be *.rf. (Not the second file/argument)
If you don't understand what I mean:
The things above are just examples; I want to make something like my own programing language where files have to have a specific file extension. You can run the program now and it compiles it to runable lua. The output file doesn't have to have a specific extension.