tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: fopen(.., "a") + fseek

On Thu, Nov 06, 2008 at 10:37:49AM -0500, Martin S. Weber wrote:
> I wonder if fopen(..., "a") is correct in ignoring any
> subsequent seeks 'backwards'. I always thought fopen(..., "a")
> would be equivalent of doing fopen(..., "r+"); fseek(.., 0, SEEK_END);
> Seems I'm wrong. But is the following intended?

SUSv3 on fopen(3):
        Opening a file with append mode (a as the first character
        in the mode argument) shall cause all subsequent writes
        to the file to be forced to the then current end-of-file,
        regardless of intervening calls to fseek().

So yes, it is intended


Home | Main Index | Thread Index | Old Index