I've thousand of line, so it's hard to copy and paste.. the method should be read the file, find blank's newline, append something.. but I don't know how to code..
I've thousand of line, so it's hard to copy and paste.. the method should be read the file, find blank's newline, append something.. but I don't know how to code..
That method won't work and doesn't describe what you indicated you wanted.
appending: adding to the end (of a file)
When you write to the middle of a file, the file doesn't grow to accommodate what you've written there, instead whatever data was there before you wrote to the file is lost.
Your content:
1234
56789
abcdefgh
ijklmnop
What you got:
1234
56789
something heremnop
The usual way this is done is to read from the old file into memory, replacing what we want to replace, and then write out the updated data to a new file.