❔ Replace multiple Lines
What I had before was
I now realize that I'm essentially opening the file every iteration. What I'm trying to figure out is how I can go through multiple lines and write them all at once time. If anyone knows it'd be appreciated. Gonna keep trying to figure it out for the time being.
5 Replies
It'd be best to use JSON if possible
Read -> deserialize -> update -> serialize -> save
Unfortunately it's not. 😦 It's an ini file for a server that the program handles.
Suppose I could have it read->Serialize->Update->SaveNew->ReadNew->Deserialize->Save
that just feels like a headache though lol
Why would you want to read the file you just saved?
Just read it once, do all the modification you need, then save it
I'll give it a go. New approach for me. Thanks
Okay, When you said why would you want to read the file you just saved it made me think some more. The answer was so obvious, so THANK YOU. Simply changed the data to
PS. The Reason to reread it at the end there is that it should have all new values, so if they choose to display changes it helps to verify the file was actually changed
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.