|
From: Benjamin R. <Ben...@ep...> - 2003-06-19 18:29:10
|
Hi Bernd, Oscar,
> ml...@mu... writes:
>> when fseek is called, for example, like this:
>>
>> file_pointer=fopen(filename,"ab");
>> fseek(file_pointer,4,SEEK_SET);
>>
>> it actually seeks to the end of the file instead of the 4th byte.
>> Is this a known problem under Windows ?
Oscar Fuentes <of...@wa...> writes:
> A look at the C standard should clarify things, but it's too late
> here.
If I may, C89 says:
Opening a file with append mode ('a' [...]) causes all subsequent
writes to the file to be forced to the then current end-of-file,
regardless of intervening calls to the fseek function.
It doesn't seem to mention how ftell() is supposed to behave, but I
guess that just ignoring fseek() on such a stream is reasonable.
Things get more interesting with "a+b", because that should allow
reading at any place in the file, so with such a stream fseek() can
not be a no-op.
benny
|