Reading and Writing to specific lines in a file

Does anyone know how to read a specific line from a file and write to a specific line in a file?

something like this:
file:write_line(LINENUMBER, DATA_TO_WRITE)
string = file:read_line(LINENUMBER)

Is this possible?

If it’s not I’d like to use SQL lite but I dont know if its persistent from app session to app session? [import]uid: 44393 topic_id: 13576 reply_id: 313576[/import]

You could read the file into a table line by line, then you can access the line you want using the table pos then write it back in to the file when you’re finished.

[import]uid: 2131 topic_id: 13576 reply_id: 49928[/import]

Wouldn’t this require writing the whole table over the existing file whenever I wanted to change something? I feel like this would take a lot of time to process. [import]uid: 44393 topic_id: 13576 reply_id: 50027[/import]