If a file is opened using the following command:
FILE *f1=fopen(\"test.dat\",\"a+\");
The man page reads:
a+
You can never mix reading and writing operations on a FILE
without calling fseek
in between. It may work as you wish on some implementations, but a program that depends on this has undefined behavior. Thus the questions of having 2 positions is meaningless.
No.
There is just one pointer which initially is at the start of the file but when a write operation is attempted it is moved to the end of the file. You can reposition it using fseek
or rewind
anywhere in the file for reading, but writing operations will move it back to the end of file.
No it has only one pointer.