* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)fwrite.c 5.5 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
* Write `count' objects (each size `size') from memory to the given file.
* Return the number of whole objects written.
fwrite(buf
, size
, count
, fp
)
iov
.iov_base
= (void *)buf
;
uio
.uio_resid
= iov
.iov_len
= n
= count
* size
;
* The usual case is success (__sfvwrite returns 0);
* skip the divide if this happens, since divides are
* generally slow and since this occurs whenever size==0.
if (__sfvwrite(fp
, &uio
) == 0)
return ((n
- uio
.uio_resid
) / size
);