Saying that I have such a file as below:
abc
def
2
3
1
fgh
I need to:
1) find the first letter f and append a string mark;
2) find the second letter f and replace it with a string mark2;
3) make the numbers in order.
Meaning that the file above should be like this:
abc
defmark
1
2
3
mark2gh
I've learnt that we have functions like seekg and seekp but I've no idea about how to use them. Also, I think I can read the numbers into an array, make them in order and overwrite them but I don't know how.
Or maybe I shouldn't use C++ to do this? But I've tried Linux script and it seems to be very complex too.
Aucun commentaire:
Enregistrer un commentaire