Can anyone please explain briefly the difference between ios::ate and ios::app in c ++? | Sololearn: Learn to code for FREE!

+1

Can anyone please explain briefly the difference between ios::ate and ios::app in c ++?

4/14/2021 3:41:56 AM

KAUSHAL KUMAR

1 Answer

New Answer

+5

When file is in "ios::ate" mode, then the write pointer of the file is transferred to the end of the file only at the time of opening it, means you can change the location of it ( using seekp() ) anytime to write anywhere else in the file. In case of "ios::app", write pointer is placed at the end of the file before every writing operations, means no matter how much you move the pointer ( using seekp() ), everytime you would try to write something to the file, the write pointer would be relocated at the end and contents would always be appended at the end of the file.