If I open a (say) binary file, and I want to append the end of it both of the following ways seem to work for me
fileVar = fopen("FileName", "w+b");
and
fileVar = fopen("FileName", "r+b");
I have read the documentation, but I'm not clear about the difference between these two methods of opening the file. This website says that w+
will overwrite a file if it doesn't exist already, and a+
will append to the end of the file. I haven't tried using a+
, but it seems to do the same thing as r+
.
Question: What exactly is the difference between the three ways of opening a file, r+
, w+
and a+
?