Opening a file in 'a+ 'mode

后端 未结 3 1456
感情败类
感情败类 2020-12-20 15:44

If a file is opened using the following command:

FILE *f1=fopen(\"test.dat\",\"a+\");

The man page reads:

a+

3条回答
  •  猫巷女王i
    2020-12-20 16:29

    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.

提交回复
热议问题