It would appear, based on the error message, that you have accfile defined at the outer scope as being an ifstream, and you still can't write to an ifstream.
It would appear, based on the error message, that you have accfile defined at the outer scope as being an ifstream, and you still can't write to an ifstream.