So I was going through File handling again trying to make a big program to perform certain operations on a file but now i can't move forward because of this error :
While showing the content of the file i get one extra character at the last.
If i write : Hey It is akshat
Output is : Hey It is akshatt
This is really weird,it didn't happened the last time i worked on file handling
i know i am doing some small mistake,please help.
It is because your first implementation tested the stream state after the output statement, the second snippet tests the stream state before you try to output the value.