2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
5 ANSI C function fwrite().
10 #include <dos/dosextens.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
14 #include <aros/debug.h>
19 /*****************************************************************************
27 const void * restrict buf
,
30 FILE * restrict stream
)
33 Write an amount of bytes to a stream.
36 buf - The buffer to write to the stream
37 size - Size of one block to write
38 nblocks - The number of blocks to write
39 stream - Write to this stream
42 The number of blocks written. If no error occurred, this is
43 nblocks. Otherwise examine errno for the reason of the error.
48 ******************************************************************************/
52 D(bug("[fwrite]: buf=%p, size=%d, nblocks=%d, stream=%p\n",
53 buf
, size
, nblocks
, stream
56 fdesc
*fdesc
= __getfdesc(stream
->fd
);
65 if (nblocks
> 0 && size
> 0)
66 cnt
= FWrite ((BPTR
)fdesc
->fcb
->fh
, (CONST APTR
)buf
, size
, nblocks
);
72 errno
= IoErr2errno (IoErr ());