Mail Archives: djgpp-workers/1999/10/21/17:48:58
Bonjour M. Richard Dawe
>
> I was looking at fseek(), fgetpos(), fsetpos() earlier and I noticed that
> fsetpos() appears to ignore the return value of fseek(). Is this intended?
> If not, there's a patch below to fix it. I also altered the return value
> to be -1, to be consistent with fseek(). If this is the intended
> behaviour, may I ask why?
>
> Here's the patch:
I don't think this is a bug, fsetpos() returns 0 if it succeeds otherwise
it returns a non-zero value and sets errno to indicate the error.
However all implemetations have seen just call fseek()
int fsetpos(FILE *stream, const fpos_t *pos) {
return fseek(stream, *pos, SEEK_SET);
}
and let errno propagates up, I did not expect the EFAULT.
I agree that consistency is good, but this is not a bug and no particular
meaning should be taken on the return value besides != 0.
if (fsetpos(stream, pos) < 0) { .. } /* wrong */
if (fsetpos(stream, pos) != 0) { .. } /* good */
Cheers ..
--
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!
- Raw text -