If you read my codeOriginally Posted by Salem
that's what I did !
I just said
"writes<<c;"
that should put the string in the file where ever the put pointer is.
but nothing happens !
If you read my codeOriginally Posted by Salem
that's what I did !
I just said
"writes<<c;"
that should put the string in the file where ever the put pointer is.
but nothing happens !
But writes is an update file - you're busy reading AND writing it.
Just simplify the problem to one file for reading, and one for writing.
> fstream writes("new.txt",ios::out); // NO ios::in
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
If I did that then I didn't do something new.
But let me put it this way
"writes" has data.
I want to write the data found from "reads" in the last line of "writes" i.e add data to writes without deleting old data.
I'm thinking about incrementing the put pointer till the eof
but i'm not sure how to do that !
Thanks for helping, much appreciated
> I want to write the data found from "reads" in the last line of "writes" i.e add data to writes without deleting old data.
Then by far the simplest is to copy the N-1 lines from the old version of "writes" to the new version of "writes".
For the last line, read it from old "writes", make whatever changes you need to make then write the changed line to the new version of "writes".
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.