replace newline with some text
my content :
what I want :
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..
Last edited on
You can use
getline to read whole lines and then
stringstream to parse the line.
|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.
What you got:
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.
Topic archived. No new replies allowed.