my task is to replace a string with another string in a file line.
I am still in the beginning of my studies in C programming language and I am facing some problems. I should find the lines beginning with #define, get their values and delete them. Then wherever the constant name appears, it should be replaced with its value. I have already saved the define values from the file but I have some difficulties in replacing the constant names with their values. So far I have two arrays where I have saved the constant names and the values:
char constant_names[256];
char constant_values[256];
I will be so thankful if you can give me some ideas about the solution of the task.
definetags will not be trivialchars are written one after another in memory, so you cannot do it in the same file. If you want, later, you can delete the old file, and save the new one with the same name.