c中以"a+"或者"ab+"模式打开一个文件,然后在文件中写入一些内容比如abcd,然后用fseek函数重新定位在流中的位置,fseek(fp, 2, SEEK_SET);
再次写入内容,比如字母z,会不会在这行abcd中插入z这个字母,或是把其中的字母改写为z
我查阅了msdn关于fseek的说明,上面表明在更新模式下是可以通过fseek改变写入位置的:
The fseek and _fseeki64 functions moves the file pointer (if any) associated with stream to a new location that is offset bytes from origin. The next operation on the stream takes place at the new location. On a stream open for update, the next operation can be either a read or a write.
但是我在VS2012上亲测,结果是和添加模式一样,新写入的内容总是被写在文件的尾部
请问到底是怎么回事呢?