txt replace line

I made a little game and I use a txt file to represent the map.
I've come at the point where it would like to edit a character in my txt.
(f.e when a treasure has been taken it should be removed from the game map)

my question:
-What function can I use to point to a certain line in a textfile. I would like to change the character at line y, at position x. I know how the string.replace() works for the x coordinate, but I don't know how to point to the right line.

Thanx in advance, sorry for the textwall, and my bad english

Best is probably to just read the map from file when you start the game and make all read and write to them map by changing the map in memory. If you want to save the game you can write the map back to file by just writing the whole map to the file.
the problem is that the game has a scroll map and each time that i move left or write I update a substring taken from the whole line of the map (in the txt). So i would like to make the change in the txt and not in the memory.
Thanx Peter for your answer.
Topic archived. No new replies allowed.